develooper Front page | perl.perl6.language.datetime | Postings from August 2000

epoch for time

Thread Next
Tim Jenness
August 19, 2000 18:02
epoch for time
Message ID:

I'm of the camp that feels perl should have a fixed epoch rather than the
epoch of the underlining OS. Furthermore, I can understand that the OS
epoch can also be important when looking outside of perl. Thinking this
over for a while it occurred to me that time() currently has no arguments
and that an epoch argument would seemingly solve all our problems.

     time()          - returns seconds since Perl epoch
     time("sys")     - seconds since start of OS epoch
     time("tai")     - seconds since TAI began
     time("jul")     - seconds since julian day 0
     time("vms")     - seconds since VMS epoch (MJD 0)
     time("wall")    - seconds since Larry Wall was born

The only assumption here is that time() returns seconds (not necessarily
integers) from an epoch and that Perl epoch is the thing expected by the
localtime() replacement. Whether time() returns fractioanl seconds or a
libtai object (with seconds and nanoseconds) is another issue. All of
these are simply integer second offsets from each other.

Tim Jenness
JCMT software engineer/Support scientist

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About