[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

system time




It's time :-) to understand why my DEBIAN/GNU/LINUX system
thinks that the "BIOS time" is set up as the GMT time and
shift it to the "local" time.

1- what part of the system controls this behavior ? is
there only a flag somewhere whose value could be only GMT
or LOCAL ?

2- how can i change this behavior ?

When Linux starts it reads a time from the Real-Time Clock (aka BIOS clock). This time is used to set the initial system time; the system time is always UTC and whatever timezone you have is easily calculated from that (provided you have the timezone files which describe the often ridiculous political rules for local time). By default, the user is always presented with a local time despite the fact that the system is maintaining UTC.

Under UNIX it has always been possible for every single process to set its own local time - so people in New York and Sydney can log into the same machine and see their own time.  WinDos is vastly inferior and after 30 years M$ still have not learned how to manage time.

To instruct your system tools to interpret the RTC time as UTC or localtime, first set the system-wide timezone in /etc/timezone (you can use the tzselect tool for this). Then edit the /etc/default/rcS file and make sure you have an entry like:
UTC=no  (if you want the RTC to store local time)
UTC=yes (if you want a sensible time)
Note that when the systems shut down (WinDos and Linux alike), the scripts will usually update the RTC.  If you don't use UTC only (UTC makes life difficult with WinDos), very stupid things happen in timezones with Daylight Savings Time when the time is altered by a step of 1 hour.

Now, just to make sure the RTC (aka hardware clock) is correctly set (whatever that means), you need to first issue a "date" command to change to your current local time/date:
date -s "07 Sep 2007 18:00:46.25"
(you can add  '-u' to parameters if you want to specify a UTC date) That will reset your system clock - now to reset the RTC:

hwclock --localtime --systohc  (to write a political time into the RTC)

hwclock -u --systohc (to write UTC to the RTC)

By the way, the astronomical community has been trying to eradicate the use of "GMT" for over 60 years now. As of 1986 (consult the Royal Astronomical Almanac of that year), GMT was officially abolished.



Reply to: