date manupulation strangeness

Eugene Grosbein eugen at kuzbass.ru
Sun Oct 28 11:36:51 PDT 2007


On Sun, Oct 28, 2007 at 07:20:11PM +0100, Holger Kipp wrote:

> > # unixtime=1193511599
> > # LC_ALL=C TZ=Asia/Krasnoyarsk date -jr $unixtime
> > Sun Oct 28 02:59:59 KRAT 2007

Here it shows 'Sun Oct 28 02:59:59 KRAST 2007' really
(cut-n-paste error, mea culpa). Take a note of zone name,
KRAST stands for 'KRAsnoyarsk Summer Time' and
KRAT stands for 'KRAsnoyarsk Time' (winter one).

> > That's last second of Summer time in this time zone.
> > 
> > # LC_ALL=C TZ=Asia/Krasnoyarsk date -f %s $unixtime
> > Sun Oct 28 02:59:59 KRAT 2007
> > 
> > That's an hour later after the switch from Summer time,
> > but how can it be? It is a bug?
> 
> I haven't checked, but usually during switch from summer
> to winter time, you change the clock back from 03:00 to
> 02:00, so you have the same hour twice.
> 
> So you have 02:59:59 summer time and then you have
> (instead of 03:00:00) 02:00:00 winter time a second
> later, so one hour later you end up with 02:59:59 again.

Yes, but "02:59:59 KRAT" is one hour (minus one second) later
than "02:00:00 KRAT", the latter equals to "03:00:00 KRAST",
so the first invocation of 'date' command shows time an hour
before time the second invocation shows. However,
unixtime is the same. That bothers me, something is wrong.

Eugene


More information about the freebsd-stable mailing list