[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] "Epoch-making difference"--time()



At 01:18 96.04.04, Matthias Ulrich Neeracher wrote:
>[...].  Mac's time(), on the other hand,
> >returns seconds since 1904/01/01 just like that of toolbox and HyperTalk's "
> >the seconds".  as a result timegm() of my newtimelocal.pl was off 2082877200
> >seconds, or whatever &timegm(0,0,0,1,0,70) of original timelocal.pl returns.
>
> Yup.

  And it was documented at the very top of VARIA.  Darn!  It was so clear I
missed.

from MacPerl.Specifics
> 1. VARIA
>
> All time related functions measure time in seconds from 1904, not 1970 as in
> Unix.

I searched for string "time(" and that darn paran stood in a way.

> *changed* :-)

  Sorry.  You are right and so is Mac's time().  It is just a matter of Epoc
h and ANY Epoch is bound to be relative unless we set the Epoch to the very
moment of Big Bang.  (I wonder how large the int must be to implement such s
cale of time.  Even quadword looks not big enough).

> As veteran subscribers to this [MacPerl] mailing list can surely recall, my
> position on questions like these is essentially:
>
>  - For functions that directly map to ISO C/POSIX.1 concepts, Perl programmers
>    should not expect any guarantees beyond what those standards say.
>  - Issues left implementation defined by those standards are resolved in
>    favor of existing Macintosh precedents if such exist. Otherwise, they
>    are resolved to follow typical Unix implementations as far as possible.

   Your view, IMHO, is quite reasonabile and for the time being, I'll rewrit
e newtimelocal.pl and other releated time-releated libraries of mine to be M
acPerl compatible.  Now the question is, what is the best way to find whethe
r the code is running on MacPerl or not.  In the previous mail I said I can
do so by checking the value of $[, but this can be easily tricked by renamin
g the application.  Another way to go is the check the value of $ENV{'MACPER
L'}; if empty it's not MacPerl.  But is this a guaranteed way?

Dan the "Not Lazy Enough" Perl Coder