LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 10-01-2015, 01:46 AM   #1
Feliks
Member
 
Registered: Sep 2015
Location: Big Island ;)
Distribution: Arch, Anything I can get my hands on in a VM (;
Posts: 53

Rep: Reputation: Disabled
Question Hardware clocks?


I'm confused about Hardware clocks. I've viewed multiple wikis on it but it just doesn't make sense... Why should the time between OS's even matter? So what if my Windows counts time differently than Mac? (/Linux)


In addition to just understanding the concept^, please help me: how should I set up the hardware clocks for a triple boot system with Windows 10, Arch Linux, and Mac OS X Yosemite?
 
Old 10-01-2015, 04:43 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,260

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Rightly so. Hardware clocks are confusing, because they are an antiquated piece of (expletive deleted) left over from the original pc spec. Esee the things they did with A20? (the address bus line).

There is no right way to handle them. Decide what single statement of time it will store.
 
Old 10-01-2015, 05:08 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,681

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
The sole purpose of the hardware or RTC clock is to set the system clock when the computer is powered on. Windows expects the hardware clock to be set to local time and linux defaults to UTC but can configured as local. If dual booting it should be set for local time and then when installing linux there will be a configuration page that sets the time zone and hardware clock setting for local or UTC.

The only reason it matters is that the linux system clock is based on UTC and if the hardware clock is not configured correctly the displayed time, logs etc will not be correct. It may not be important for the home user but but time synchronization is critical is in a domain environment.

I suggest installing NTP (Network Time Protocol) which will keep the system/hardware clock accurate.

The system clock is basically a counter where 0 = 00:00:00 (UTC), Thursday, 1 January 1970, If the operating system does not know how the hardware clock or timezone is configured as stated the display as well as all time stamps will be wrong.
 
Old 10-03-2015, 10:14 PM   #4
seasons
Member
 
Registered: Dec 2014
Distribution: siduction
Posts: 264

Rep: Reputation: 58
Set the clock to UTC and make Linux and OS X happy. Then tell Windows that the time is in UTC (and you want it to stay that way). https://wiki.archlinux.org/index.php...UTC_in_Windows
 
Old 10-03-2015, 11:18 PM   #5
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,314
Blog Entries: 28

Rep: Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137
I don't quite agree that hardware clocks are antiquated, as some method is needed to remember the time while a computer is powered off, but coordinating the hardware clock and the system clock under *nix can be truly annoying.

I once was dual-booting Slackware and Fedora. Slackware was set to UTC, but for some fool reason (probably something I overlooked during the install), Fedora was set to local time. That led me to learn the date and hwclock commands. Well, "learn" is probably not the right word, as I always have to consult the man pages; "familiarize" might be more accurate, because, really, it's not something you have to deal with very often.

Once you set the time with the date command, which for me is the the easiest way to set the date once you get the hang of the format, you can use

Code:
hwclock -w          <--it's been several years, but I think that's the command.  If not, someone will correct me.
to set the hardware clock to the system clock.

From the hwclock man page:

Code:
-w, --systohc   Set the Hardware Clock from the System Clock, and update the timestamps in /etc/adjtime.
 
Old 10-04-2015, 03:57 AM   #6
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,260

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
I find 'hwclock -hctosys OR -systohc helpful, as is man date. Then sort it and move on. If the same error always shows, add a command to rc.local and sort it.
 
Old 10-04-2015, 02:25 PM   #7
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 999

Rep: Reputation: 142Reputation: 142
Quote:
Originally Posted by business_kid View Post
Rightly so. Hardware clocks are confusing, because they are an antiquated piece of (expletive deleted) left over from the original pc spec. Esee the things they did with A20? (the address bus line).

There is no right way to handle them. Decide what single statement of time it will store.
Hi
Don't understand
How would the PC know the current time and do absolute-time-related things if it wouldn't have the current datetime? (and it doesn't have an Internet connection with which to retrieve the current time OR the timesource does not work or provides the wrong time because it's corrupted)?
 
Old 10-04-2015, 02:30 PM   #8
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Quote:
Originally Posted by seasons View Post
Set the clock to UTC and make Linux and OS X happy. Then tell Windows that the time is in UTC (and you want it to stay that way). https://wiki.archlinux.org/index.php...UTC_in_Windows
This is what I did on this laptop (possibly even using the page linked to) and I dual boot Debian and Windows 10 with no time issues now.
 
Old 10-04-2015, 08:25 PM   #9
seasons
Member
 
Registered: Dec 2014
Distribution: siduction
Posts: 264

Rep: Reputation: 58
Quote:
Originally Posted by 273 View Post
This is what I did on this laptop (possibly even using the page linked to) and I dual boot Debian and Windows 10 with no time issues now.
Thanks for confirming it still works with Win10.

Also, I gave instructions in reverse. First, you should tell Windows not to mess with your system time, and then you should boot into BIOS and set the time to UTC.
 
Old 10-10-2015, 03:16 AM   #10
Feliks
Member
 
Registered: Sep 2015
Location: Big Island ;)
Distribution: Arch, Anything I can get my hands on in a VM (;
Posts: 53

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by 273 View Post
This is what I did on this laptop (possibly even using the page linked to) and I dual boot Debian and Windows 10 with no time issues now.

Quote:
Originally Posted by seasons View Post
Thanks for confirming it still works with Win10.

Also, I gave instructions in reverse. First, you should tell Windows not to mess with your system time, and then you should boot into BIOS and set the time to UTC.
Thank you both very much. So the first answers what my original question basically was, I don't know if I made it clear enough; basically I didn't know what issues, if any, having different clocks set up would cause. I figured, so the different OSs will have different times, oh well? I mean I'm still a bit confused but ah ok, it can cause problems and that's why they say to make sure they match?

the second makes me question what to do because the first guy said he did the original steps and now you're saying to do them the other way around.

So to fix the hardware clocks issue, what should I do? (Please get it right this time and that's not to sound rude I just don't want to mess anything up!! Haha sorry if it sounded rude I surely don't mean it to)
 
Old 10-10-2015, 04:40 AM   #11
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
OK, to try to answer logically:
The hardware clock is set to a time, let's call this hardware time.
When Linux boots it assumes that hardware time is UTC, or Coordinated Universal Time*, which is a kind of "time zone 0" upon which all time zones are then based. The Linux system checks the time zone which your system is set to and adds or subtracts from this to display what we'll call display time. This display time is used whenever you ask the system to display something like the last time a file was modified.
When Windows boots it assumes that hardware time is the correct time in your time zone so it simply sets display time to hardware time.
To complicate things Linux and Windows [slightly less commonly] can synchronise time to the internet and then set the hardware clock appropriately -- Linux will set the hardware clock to true UTC and Windows to the true real time in your time zone.
The above means that dual booting usually means that one or both the operating systems displays the wrong time.
To resolve this one either sets Linux to assume hardware time is the local time of your system or sets Windows to assume that hardware time is UTC.
Personally, I think it is better to set Windows to assume that the hardware is set to UTC. This is for a few reasons but mainly because I think it is "neater" and more easy to understand and because if, for some reason, the time zone information in one of the operating systems is wrong (more likely to happen around daylight savings time) the hardware clock should remain at UTC so the other OS should be unaffected.

For completeness things like file opening and modification times under Linux are stored as Unix or Epoch Time which is the amount of time which has passed since 00:00:00 UTC on 1 January 1970.


*Yes, the initials seem in the wrong order, this is for political reasons explained in the Wikipedia article.
 
1 members found this post helpful.
Old 10-10-2015, 07:25 AM   #12
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
In actuality Linux uses hwclock as reference at boot, then runs on its own. Linux may or may not (depending how it is set up) write the time back to hwclock at shutdown.
 
Old 10-10-2015, 04:10 PM   #13
Feliks
Member
 
Registered: Sep 2015
Location: Big Island ;)
Distribution: Arch, Anything I can get my hands on in a VM (;
Posts: 53

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by 273 View Post
OK, to try to answer logically:
The hardware clock is set to a time, let's call this hardware time.
When Linux boots it assumes that hardware time is UTC, or Coordinated Universal Time*, which is a kind of "time zone 0" upon which all time zones are then based. The Linux system checks the time zone which your system is set to and adds or subtracts from this to display what we'll call display time. This display time is used whenever you ask the system to display something like the last time a file was modified.
When Windows boots it assumes that hardware time is the correct time in your time zone so it simply sets display time to hardware time.
To complicate things Linux and Windows [slightly less commonly] can synchronise time to the internet and then set the hardware clock appropriately -- Linux will set the hardware clock to true UTC and Windows to the true real time in your time zone.
The above means that dual booting usually means that one or both the operating systems displays the wrong time.
To resolve this one either sets Linux to assume hardware time is the local time of your system or sets Windows to assume that hardware time is UTC.
Personally, I think it is better to set Windows to assume that the hardware is set to UTC. This is for a few reasons but mainly because I think it is "neater" and more easy to understand and because if, for some reason, the time zone information in one of the operating systems is wrong (more likely to happen around daylight savings time) the hardware clock should remain at UTC so the other OS should be unaffected.

For completeness things like file opening and modification times under Linux are stored as Unix or Epoch Time which is the amount of time which has passed since 00:00:00 UTC on 1 January 1970.


*Yes, the initials seem in the wrong order, this is for political reasons explained in the Wikipedia article.
Awesome reply. I get it now!! So how do I go about setting Windows to UTC time? I hear this involves messing with registry and stuff and don't want to mess anything up.
 
Old 10-10-2015, 04:27 PM   #14
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Quote:
Originally Posted by Feliks View Post
Awesome reply. I get it now!! So how do I go about setting Windows to UTC time? I hear this involves messing with registry and stuff and don't want to mess anything up.
This reply links to the necessary registry edit.
Quote:
Originally Posted by seasons View Post
Set the clock to UTC and make Linux and OS X happy. Then tell Windows that the time is in UTC (and you want it to stay that way). https://wiki.archlinux.org/index.php...UTC_in_Windows
For what it's worth I googled around and found the same answer in multiple places then tried it and it worked.
I have actually told both Linux and Windows to set their time using the internet but that is optional. One thing I would advise is to set that registry value, reboot into Windows, set the time correctly in Windows (it may have changed quite a bit from your local time) then reboot into Windows again and check it has stayed. Then boot into Linux, check the time is OK, then reboot back into Windows to ensure nothing has gone awry. I have to admit to not having set my Linux system to local time so I'm not sure how one changes between local time and UTC if you are in that situation but the Arch page linked to should give some help.
I have to admit to being a little fascinated by time zones and UTC offsets to the extent that I tend to talk in 24 hour ("military time" to those in the US), wear a watch with the ability to show the time anywhere in the world and get anxious during British Summer Time ("Daylight Savings Time"). I sorely miss the old KDE ability to have KWorldClock as wallpaper.

Last edited by 273; 10-10-2015 at 04:29 PM.
 
Old 10-10-2015, 06:59 PM   #15
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,681

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
The correct term is Daylight Saving time. Time is fascinating. For something that appears simple is quite complex
 
  


Reply

Tags
hardware clock



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Clocks and time fumikon Linux - Kernel 6 07-09-2015 06:57 PM
My hardware and system clocks are both slow XicKy Linux - General 1 11-20-2006 02:46 PM
Put 2 clocks madmax1143 Linux - Software 2 07-21-2006 08:36 AM
my clocks are weird boxerboy Fedora 9 08-07-2005 09:38 PM
Syncronize Clocks newuser455 Linux - Newbie 2 07-15-2005 08:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 11:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration