Automatic time change problem

Denys Vlasenko vda.linux at googlemail.com
Wed Feb 27 12:32:15 UTC 2008


On Wednesday 27 February 2008 11:02, Frederic Kwiatkowski wrote:
> When my device is running, automatic time switch occurs between
> summer/winter seasons. So everything goes right.

There is no "time switch" in Unix. Internally, time is running in GMT.
It's only when machine converts "seconds since 00:00 1 Jan 1970, GMT"
to "string representation of the time/date", it abjusts representation
to timezone and daylight saving shift.

For determining those, glibc uses /etc/localtime and uclibc uses
/etc/TZ. Example from my machine:

# ls -l /etc/localtime
lrwxrwxrwx    1 root     root           47 Feb 12 18:02 /etc/localtime -> /usr/app/glibc-2.4/share/zoneinfo/Europe/Prague

# cat /etc/TZ
CET-1CEST-2

If TZ env variable is set, it overrides /etc/TZ.
Somewhat complex example with exactly specified daylight saving
transition times:

TZ="EET-2EEST-3,M3.5.0/03:00:00,M10.5.0/04:00:00"

> But if the time change date occurs when the device is off, at startup, date
> is not set up correctly.

Probably your NVRAM (battery) clock is running in local time,
and it cannot detect/adjust for daylight saving transition.

Change it to run in GMT and fix startup script to understand
that. This way, there will be no transitions to worry about.
(This would screw Windows' idea of current time - it assumes
NVRAM clock is always in local time. Stupid).
--
vda



More information about the busybox mailing list