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

Re: RFC 99 (v3) Standardize ALL Perl platforms on UNIX epoch

Thread Previous | Thread Next
From:
Chris Nandor
Date:
September 14, 2000 04:12
Subject:
Re: RFC 99 (v3) Standardize ALL Perl platforms on UNIX epoch
Message ID:
p05001900b5e660cd7b91@[192.168.0.77]
At 0:12 -0400 2000.09.14, Chaim Frenkel wrote:
>Possibly a few functions to make it easy.
>
>$Perl::EpochOffset
>
>	0 		on a unix box
>	966770660	on a Mac (Lifted from pudge's previous email)
>	etc.
>
>Then on output. print time()-$Perl::EpochOffset;

No, that won't really work.  When my offset from GMT changes for daylight
savings time, it will break.  The point of having a module is that epoch
conversions are more complicated than that.  For example, Mac OS epoch
begins at Jan 1 1904 00:00:00 _local time_.  That is why the timezone
offset from GMT was passed to the Time::Epoch functions.

This is probably why I don't think too many Mac people would mind if the
epoch in MacPerl changes; it is unreliable for keeping persistently on Mac
OS anyway.  That doesn't mean it is never useful, but you can't save the
epoch to disk without the GMT offset and have it be useful, unless you know
you'll never change time zones.  In the U.S., that means living in one of
the few places that ignores DST, and that you aren't using a laptop that
you travel to other places with, and that you aren't planning on moving ...
in other words, it is safer to use a more unambiguous representation for
storing the time.

Also, you might want to convert between other epochs; what if you get an
epoch value FROM Mac OS on a Unix box, and want to convert it?

So again, are there any other platforms that do not have as the beginning
of their epoch 1970-01-01 00:00:00 +0000?  I think we need to list all of
them and note which ones can be changed in the manner proposed, and which
ones can't.


>I personally prefer to pass around the string representation, more
>that perl and unix systems need to handle datetime. (And I find it
>easier to read the ISO version than a time in seconds)

I think it would be reasonable to have a quick-and-easy way to get the time
in the extended ISO format, as Russ noted it.

-- 
Chris Nandor                      pudge@pobox.com    http://pudge.net/
Open Source Development Network    pudge@osdn.com     http://osdn.com/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About