At 17:47 -0400 2000.09.14, Chaim Frenkel wrote:
>>>>>> "CN" == Chris Nandor <[EMAIL PROTECTED]> writes:
>
>CN> No, that won't really work.  When my offset from GMT changes for daylight
>CN> savings time, it will break.  The point of having a module is that epoch
>CN> conversions are more complicated than that.  For example, Mac OS epoch
>CN> begins at Jan 1 1904 00:00:00 _local time_.  That is why the timezone
>CN> offset from GMT was passed to the Time::Epoch functions.
>
>I'm confused.
>
>How do you expect the program to know the timezone if the OS doesn't?

I am not sure what you mean by "the program."  If you mean perl, well, perl
often doesn't.  Figuring out the correct time zones is sometimes quite
hard.  And yes, sometimes the OS is completely lacking in knowledge of a
time zone.  If you'll note, the Time::Epoch example asked that the time
zone differential be one of the arguments, because we don't want to rely on
guessing (but we fall back to guessing if none is supplied).

Assuming the OS does know, and perl can find out from the OS, then perhaps
a variable would work.  But I, for the most part, despise the idea of
adding more global variables to Perl.  I would much rather call a simple
function.


>And if the program knows it and can track it, then we can hand off the
>responsibility to Perl.

My program knows the timezone difference because I hardcoded it in.  :)


>CN> Also, you might want to convert between other epochs; what if you get an
>CN> epoch value FROM Mac OS on a Unix box, and want to convert it?
>
>That's a different problem than we are trying to solve.

I don't think so.  What we are trying to solve is the problem of different
system epochs.


>This is a wider
>problem then a fixed epoch for perl. Let's turn this around. What if
>we are on a platform that doesn't use perl's epoch and we need to write
>a value to a file?

Yes.  What if?  That's what we're addressing.  Right now, you need to use
something like Time::Epoch to do a conversion, or you use a non-ambiguous
representation, such as you get with Date::Manip (which, BTW, I believe is
broken in respect to MacPerl's epoch; that is, I think I needed to convert
to Unix epoch before doing something with it).

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to