[Discuss] Interesting linux date bug

Alan W. Irwin irwin at beluga.phys.uvic.ca
Mon Mar 3 16:19:19 PST 2008


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
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the Discuss mailing list