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

Re: Timestamps jump by one hour when switching timezone



Rodolfo Medina wrote:

> Hallo.
> 
> Last sunday, in my time zone (Rome), clocks were got back by one hour.  I
> noticed that my Debian Lenny had done so automatically, but files timestamps
> were also took back by one hour, which is not what we want.


File timestamps are (or at least should be) stored in UTC. It's the
display of them that's affected. Setting the TZ variable may help:

export TZ=UTC

Timestamps stored _in_ files (for example log files) are taken from
system time, that stored in /etc/localtime. You might want to set that
to UTC and, where required, alter the displayed time using the TZ
variable, rather than running system time on something with DST, since
it can cause problems with timestamps within log files etc. being
duplicated around the time of the change.

cp /usr/share/zoneinfo/UTC /etc/localtime

Or, you may wish to use a nearer-local non-DST timestamp:

cp /usr/share/zoneinfo/Etc/GMT-1 /etc/localtime

Personally I find using UTC/GMT on all our systems, wherever based, as
system time the simplest, and managing the displayed time using TZ as
applicable. It means to read log files you need to convert, but at least
it's in only one direction, wherever you are.

--
Chris Jackson
Shadowcat Systems Ltd.


Reply to: