Front page | perl.perl6.language.datetime |
Postings from August 2000
Re: epoch for time
From: Tim Jenness
August 20, 2000 12:48
Re: epoch for time
Message ID: Pine.LNX.email@example.com
On Sun, 20 Aug 2000, Chris Nandor wrote:
> At 15:02 -1000 2000.08.19, Tim Jenness wrote:
> >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
> > etc.
> >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.
> So what would (stat($_))[8,9,10] return? :)
System calls will return Perl epoch - it would be a bit confusing if some
functions returned system epoch and others perl epoch. Your
perl2epoch() command could be used to convert to 'system' epoch if
> I think maybe what should happen instead is that a function or module be
> provided to handle epoch conversions, to and from the default "Perl" epoch.
> perl2epoch($perlsec, 'vms'), epoch2perl($vmssec, 'vms').
Fine with me. I was just making use of the fact that time() has no
JCMT software engineer/Support scientist