Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 03 Nov 2007 21:29:29 -0700
From:      perryh@pluto.rain.com
To:        bakul@bitblocks.com
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: timezone printing in date messed up?
Message-ID:  <472d4aa9.3uhaI9p/nWSuFpCL%perryh@pluto.rain.com>
In-Reply-To: <20071104025728.2702A5B29@mail.bitblocks.com>
References:  <20071104025728.2702A5B29@mail.bitblocks.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> > > OS X Leopard has the same bug ...
> > 
> > How did you test it in Leopard?  I tried it in Tiger, intending
> > to contribute another data point, and I got:
>
> Leopard's /bin/date accepts -j.  You can try compiling FreeBSD
> date on Tiger.

I had decided against that, since it would propagate the bug if
it happened to be in the FreeBSD /bin/date.  It turns out the
output conversion can be tested using -r:

for a in 0 1 2 3 4 5 6 7 8 9 10 11 12
do
  date -r `expr 1194163200 + 600 \* $a`
done

and this gives correct results in both Tiger and 6.1:

Sun Nov  4 01:00:00 PDT 2007
Sun Nov  4 01:10:00 PDT 2007
Sun Nov  4 01:20:00 PDT 2007
Sun Nov  4 01:30:00 PDT 2007
Sun Nov  4 01:40:00 PDT 2007
Sun Nov  4 01:50:00 PDT 2007
Sun Nov  4 01:00:00 PST 2007
Sun Nov  4 01:10:00 PST 2007
Sun Nov  4 01:20:00 PST 2007
Sun Nov  4 01:30:00 PST 2007
Sun Nov  4 01:40:00 PST 2007
Sun Nov  4 01:50:00 PST 2007
Sun Nov  4 02:00:00 PST 2007

but the original command, run in 6.1, exhibits the bug:

for a in 0 1 2 3 4 5 6 7 8 9 10 11 12
do
  date -j -f %s `expr 1194163200 + 600 \* $a`
done

Sun Nov  4 01:00:00 PDT 2007
Sun Nov  4 01:10:00 PDT 2007
Sun Nov  4 01:20:00 PDT 2007
Sun Nov  4 01:30:00 PST 2007
Sun Nov  4 01:40:00 PST 2007
Sun Nov  4 01:50:00 PST 2007
Sun Nov  4 01:00:00 PDT 2007
Sun Nov  4 01:10:00 PDT 2007
Sun Nov  4 01:20:00 PDT 2007
Sun Nov  4 01:30:00 PST 2007
Sun Nov  4 01:40:00 PST 2007
Sun Nov  4 01:50:00 PST 2007
Sun Nov  4 02:00:00 PST 2007

Maybe this helps someone familiar with the internals of /bin/date
fix it in time for next fall :)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?472d4aa9.3uhaI9p/nWSuFpCL%perryh>