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

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

Chris Nandor
September 15, 2000 06:56
Re: RFC 99 (v3) Standardize ALL Perl platforms on UNIX epoch
Message ID:
At 9:17 -0400 2000.09.15, Chaim Frenkel wrote:
>>>>>> "CN" == Chris Nandor <> writes:
>CN> At 22:19 -0400 2000.09.14, Chaim Frenkel wrote:
>>> If you want to adjust for timezones just calculate the constant. Which
>>> since you are giving it in HHMM format you might as well just calculate
>>> directly.
>>> So what am I missing.
>CN> Beats me.  I am not sure whether or not you have a point, and if so, what
>CN> it is.  I am not trying to be difficult.  Maybe I am just tired, but I am
>CN> not sure what you are trying to say.
>I'm not sure either. But my understanding still seems to be that the
>problem is a simple adjustment issue.
>	  my_time_in_local_epoc
>	+ current_os_epoch_offset
>	- timezone_ofset_in_seconds
>	= time_in_unix_epoch_seconds

But again, I don't know what you are trying to say.  Are you saying we
should have some global "constant"?  If so, you still have problems:

* We do not know if it will always be this simple for every platform
* You might need to convert from an epoch other than your native one,
whether it
  is a different time zone, or a different epoch entirely; with a function, you
  can easily take care of these problems
* Global variables suck

>So the only piece that is needed is the current os epoch offset and
>perhaps the timezone offset. But I think having perl look at TZ (or a
>PERL6TZ) on those platforms that don't handle timezones correctly
>seems like a minor tweak to the syscall wrapper functions.

TZ is unreliable.  We should never offer a solution that is going to rely
on TZ without knowing the exact details.  We need to identify platforms
that have problems and what neeeds to be done with them.

>And we can avoid breakage with current scripts.

You can only avoid breakage with current scripts if you make no changes to
the current facilities (which is what Andy proposed).  My proposal of a
separate module for handing epoch differentials will work pretty much the
same whether we change time() to return native or Perl epoch.

>No TZ, no adjustment
>current code works properly. TZ set, perl will do an adjustment.

What adjustment?  You were not before talking about doing any adjustment,
were you?  Maybe you could state exactly what you propose, because I don't
know what it is.

Chris Nandor            
Open Source Development Network Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About