Page 1 of 1
System clock for dual boot and writing to RTC
Posted: Wed Jul 09, 2014 12:50 pm
by shahsunny712
I have been reading the osdev and other online articles on RTC and the system clock. The whole thing seems quite confusing to me, but the mist is slowly beginning to clear.
I have a few questions that'll be immensely helpful in further reading:
- Linux assumes RTC is in UTC, while Windows assumes its in local time. Is this correct ?
- If the above is true, how do Ubuntu and Windows on my machine(dual-boot) show the time correctly ? I don't have the "RealTimeIsUniversal" regsitry key set in Windows, and I don't remember doing any changes in in this regard in Linux.
- Do operating systems make any changes to the time in the RTC ? If yes, how often ? Do they write the UTC or localtime ? (I read some things about syncing using NTP, but couldn't really understand it)
Re: System clock for dual boot and writing to RTC
Posted: Wed Jul 09, 2014 1:19 pm
by FallenAvatar
Is this a purely educational question? (ie. just for your own understanding) A Homework Question? (Doesn't seem likely) Or is there an actual problem you are trying to solve?
- Monk
Re: System clock for dual boot and writing to RTC
Posted: Wed Jul 09, 2014 1:23 pm
by shahsunny712
Sorry, I should have added - I was understanding how to read from the CMOS to show the time in my OS. It is from the CMOS page that I landed on several different pages, and would like to understand this before implementing the time functionality. It'll also be useful in knowing how different OSes function, and what design I should choose.
Re: System clock for dual boot and writing to RTC
Posted: Wed Jul 09, 2014 1:29 pm
by alexfru
The traditional PC RTC does not have any internal register for time zone or geographic location (nor does it have a built-in GPS or something like that). Have you ever installed Windows or Ubuntu? When you install the OS you provide this info to the OS manually. From that point on the OS knows how to translate time. Unless, of course, you travel or your government decides to change either the time zone offset or the daylight saving times at which point a mechanism is needed to find out about it and take the change into account. OS updates can bring that legal info in or you can do the adjustments manually.
Re: System clock for dual boot and writing to RTC
Posted: Wed Jul 09, 2014 3:35 pm
by Brendan
Hi,
shahsunny712 wrote:- Linux assumes RTC is in UTC, while Windows assumes its in local time. Is this correct ?
Yes, mostly. However Linux does support "RTC set to local time" and (modern) Windows supports "RTC set to UTC" - it's just the default assumptions that are different.
shahsunny712 wrote:- Do operating systems make any changes to the time in the RTC ? If yes, how often ? Do they write the UTC or localtime ? (I read some things about syncing using NTP, but couldn't really understand it)
That depends on the OS and how it's configured. For example, the computer I'm using at the moment is configured to use NTP and to update the RTC's time and date when the OS shuts down (but I could've configured it differently). I'm not sure what Windows does.
Note that (excluding compatibility reasons) the only sane option is to use UTC for the RTC. If you use local time then (without relying on NTP instead of relying on RTC) it's impossible to prevent breakage caused by daylight savings changes when there are 2 or more OSs installed, as no OS will know who is responsible for updating the RTC and they will all do it, leading to "wrong by (number of OSs - 1) hours" twice per year.
Cheers,
Brendan
Re: System clock for dual boot and writing to RTC
Posted: Thu Jul 10, 2014 4:43 am
by shahsunny712
Brendan wrote:
Yes, mostly. However Linux does support "RTC set to local time" and (modern) Windows supports "RTC set to UTC" - it's just the default assumptions that are different.
That depends on the OS and how it's configured. For example, the computer I'm using at the moment is configured to use NTP and to update the RTC's time and date when the OS shuts down (but I could've configured it differently). I'm not sure what Windows does.
So let's say I have Linux installed and everything's working fine (RTC=UTC, time in Linux=local time).
Now I install Windows. I don't remember the installation steps, but I think we had to specify the timezone. Will Windows consider the time detected at this stage as local time, even though it actually is UTC ? If I correct the time, will it change anything in RTC or only in the OS ?
Also, when I update the time in any OS, is it correct that that changes only the system clock and not the RTC ?
Re: System clock for dual boot and writing to RTC
Posted: Thu Jul 10, 2014 8:21 am
by Combuster
Also, when I update the time in any OS, is it correct that that changes only the system clock and not the RTC ?
Knowing that my system time is always wrong whenever I (accidentally) boot into windows,
at least one OS is consistently writing it.