[Discuss] Interesting linux date bug
pw
p.willis at telus.net
Tue Mar 4 08:24:36 PST 2008
Alan W. Irwin wrote:
> On 2008-03-03 11:34-0800 pw wrote:
>
>> Apparently this second didn't exist:
>>
>> date -u -d "12/31/1969 23:59:59" +%s
>
> What distro are you using? That command works fine on my (64-bit) Debian
> testing system:
>
> irwin at raven> date -u -d "12/31/1969 23:59:59" +%s
> -1
>
> Also, the epoch for one second later also works....
>
> irwin at raven> date -u -d "01/01/1970 00:00:00" +%s
> 0
>
> Just to throw a curve ball into the discussion, watch out for leap seconds,
> see http://en.wikipedia.org/wiki/Unix_time. The above epochs did not have
> leap seconds, but apparently there are Unix computer-time
> inconsistencies at
> epochs where leap seconds (necessary to account for the varying rotation
> rate of the earth) occur.
>
> Alan
I'm using centos on that machine. Centos is a peared down
redhat style distro.
The seconds on either side of that work fine. The actual +%s
value of that second should be -1 (negative one), just as you show.
On that machine the date comes up as invalid.
This is not really a big deal for me. I only noticed this because
I was making a table of unix seconds values for the ends of years.
ie:
for YEAR in `seq 1900 2035`; do date -u -d "01/01/$YEAR 23:59:59" +%s; done
Does the linux date have a leap seconds flag/setting.
Maybe that's the problem.
Peter
More information about the Discuss
mailing list