date manupulation strangeness

Holger Kipp hk at alogis.com
Sun Oct 28 14:15:41 PDT 2007


On Mon, Oct 29, 2007 at 01:35:08AM +0700, Eugene Grosbein wrote:
> 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).

ah, I see. I can reproduce it here as well:

%setenv LC_ALL C
%setenv TZ Asia/Krasnoyarsk
%setenv unixtime 1193511599

%date -jr $unixtime
Sun Oct 28 02:59:59 KRAST 2007
%date -jf $s $unixtime
Sun Oct 28 02:59:59 KRAT 2007
%date -juf %s $unixtime
Sat Oct 27 18:59:59 UTC 2007
%date -jur $unixtime
Sat Oct 27 18:59:59 UTC 2007

Interestingly, if output is forced to be in UTC, both give
the same results.

Using unixtime 1193511600 instead, I get

%date -jr $unixtime
Sun Oct 28 02:00:00 KRAT 2007
%date -jf %s $unixtime
Sun Oct 28 02:00:00 KRAST 2007

With unixtime < 1193509360 both return KRAST and
with unixtime > 1193512959 both return KRAT.

In between, one returns KRAST, the other KRAT or
vice versa...

Looks like one of the conversions is getting the
summertime-flag wrong here.

I have tested this here with 6.2-STABLE from May 20...

Regards,
Holger


More information about the freebsd-stable mailing list