Advertisement

Windows and Linux fighting over the clock....

Started by October 01, 2005 05:55 PM
15 comments, last by Halsafar 19 years, 1 month ago
Okay, Linux boots and the time is correct... Reboot Windows boots and the time is off by several hours Adjust time Reboot Linux boots and the time is off by several hours Adjust time Reboot Windows boots and the time is incorrect again... What the heck? I believe I told Linux to not touch the hardware clock during installation...
In my own Osdevelopment experiance I know you don't have to edit the time to view it via CMOS or BIOS calls in ASM or C/inline ASM, there is no reason reading it should change it, have you tried reading your distro's manual?
Advertisement
Fedora Core 4
Its documentation doesn't seem to touch on this topic.
I suggest posting this in the Fedora forums or mailing list, or submiting it as a bug.
Did you set the correct time zone in both OS ?
I bet if you change your timezone in Linux to GMT that'll fix the problem.

EDIT: The reason is that Linux expects the hardware clock to be in GMT, so the time it displays is adjusted by n hours according to which timezone you specified.

Windows, on the other hand, expects the hardware clock to be in local time, so it just displays whatever's found there.

If you set the timezone in Linux to GMT, then it won't adjust at all when displaying the time. Then when the hardware clock is set to local time, it won't be translated. It's not a great solution, but a work around.
Advertisement
In most Distros I've used it seems there's a way to tell it that the system clock isn't set to GMT, so you can input your timezone, and what timezone the system clock is set to, and it will use the appropriate offset. I know this works in Ubuntu as I run XP alongside it (with correct time/timezone in both).

Perhaps look into /etc/conf.d/clock (I don't have one but it seems it exists on Fedora and may help you.)
Linux distributions typically assume that the hardware clock is in GMT.

Having the hardware clock in GMT, is the One True Way of doing it. The fact that the hardware clock is ever not in GMT, is a bug (really the bios setup screens should have time zone support too).

The problem is that some old OSs (DOS mainly, but also Win9x because they run under Dos too) don't understand what a time zone is, and assume that all times are in your local time zone, including the hardware clock. This is a bug.

The reason this is a bug, is that a given OS cannot possibly know what timezone the hardware clock is in, nor whether it's right (without access to the internet). Therefore if two OSs both adjust the hardware clock for daylight saving time, the clock will be 1 hour ahead in the summer as it's been put forward twice. This certainly used to happen with Win95 (if you had more than one win95 installation on the same machine).

I believe that on newer MS operating systems, there is an option to keep the bios clock in GMT (or is it now mandatory? I dunno). Use that option.

If you're "running" win98, stop.

---
Note to other posters:

The OP is not suggesting that either Linux or Windows are automatically adjusting the hardware clock, but rather that he/she is manually having to adjust it in both.

Mark
Run redhat-config-time (I think that's what it's called - it might be redhat-config-date, I don't have access to a machine with Fedora on it right now). The set it up to use Network Time Protocol (NTP) to set the time. Hopefully this will solve the linux problem - can't help you with windows.
Quote: Original post by markr
Linux distributions typically assume that the hardware clock is in GMT.

Having the hardware clock in GMT, is the One True Way of doing it. The fact that the hardware clock is ever not in GMT, is a bug (really the bios setup screens should have time zone support too).



The IBM PC was DESIGNED for PC-DOS / MS-DOS. The traditional PC's BIOS' behaviour is therefore intentional and not in any way a 'bug'. Windows and MS-DOS manage to cope with its foibles quite well.

The first release of the Linux kernel appeared in 1991, fully ten years after MS-DOS, and wasn't even a viable OS until a decent GUI could be built for it, sometime around Windows 95's release.

The flaw, if any, is in Linux's hardware abstraction layer, since any truly portable OS worthy of the term should never, ever assume anything about the underlying hardware. There is no ISO standard for battery-backed clock behaviour in PCs, so claiming that the UNIX way is the "One True Way" is arrogance of the highest order.

--
Sean Timarco Baggaley
Sean Timarco Baggaley (Est. 1971.)Warning: May contain bollocks.

This topic is closed to new replies.

Advertisement