There's a good article about computerized timekeeping in the current
issue of Government Computer News:

    http://www.gcn.com/print/27_15/46509-1.html

    Who's got the time?
    As computer systems become increasingly precise, a conflict emerges
    between human and machine measurements
    By Joab Jackson

To explain epoch time, Mr. Jackson writes:

    For Posix-based computers such as Unix or Linux, time began Jan, 1,
    1970, at midnight. The time according to those machines is the
    number of seconds that have accumulated since. For instance, the
    Greenwich Mean Time 8:22 p.m., Tuesday, June 10, 2008, translates to
    1213129345 in Posix-speak. 

Naturally, I fired up DateTime to verify this value:

    C:\>perl -MDateTime -le "$dt = DateTime->new( year => 2008, month =>
    6, day => 10, hour => 20, minute => 22 ); print $dt->epoch()"
    1213129320

    C:\>

Hmm...off by 25 seconds. When I factor out DateTime, I get the same
result:

    C:\>perl -MTime::Local -le "print timegm(0,22,20,10,5,2008)"
    1213129320

    C:\>perl -MPOSIX -le "print POSIX::strftime(q{%Y-%m-%dT%H:%M:%S},
    gmtime(1213129345))"
    2008-06-10T20:22:25
    
    C:\>perl -MPOSIX -le "print POSIX::strftime(q{%Y-%m-%dT%H:%M:%S},
    gmtime(1213129320))"
    2008-06-10T20:22:00
    
    C:\>

There had been 23 leap seconds as of June 10, not 25, so this doesn't
account for the difference exactly:

    C:\>perl -MDateTime -le "$dt = DateTime->new( year => 2008, month =>
    6, day => 10, hour => 20, minute => 22, time_zone => 'UTC' ); print
    $dt->leap_seconds()"
    23
    
    C:\>

I've written the author to thank him for his excellent article and to
ask him how he computed the value 1213129345.

-- 
Jim Monty

<html>
<body>
<p>***********************************************************************</p>
<p>The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else is
unauthorized. If you are not the intended recipient, any disclosure, copying,
distribution or any action taken or omitted to be taken in reliance on it, is
prohibited and may be unlawful. When addressed to our clients any opinions or
advice contained in this email are subject to the terms and conditions
expressed in the governing KPMG client engagement letter.</p>
<p>***********************************************************************</p>
</body>
</html>

Reply via email to