[Discuss] Interesting linux date bug
DR
vlug at drsol.com
Tue Mar 4 09:04:14 PST 2008
pw wrote:
> 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
I am using:
Centos Version 5
date (GNU coreutils) 5.97
and I get the following results:
$ date -u -d "12/31/1969 23:59:58" +%s
-2
$ date -u -d "12/31/1969 23:59:59" +%s
-1
$ date -u -d "01/01/1970 00:00:00" +%s
0
$ date -u -d "01/01/1970 00:00:01" +%s
1
Deid
> _______________________________________________
> Discuss mailing list
> Discuss at vlug.org
> http://ladybug.vlug.org/cgi-bin/mailman/listinfo/discuss
>
>
More information about the Discuss
mailing list