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

Re: RFC 48 (v4) Replace localtime() and gmtime() with date() and utcdate()

Thread Previous | Thread Next
From:
Jonathan Scott Duff
Date:
September 26, 2000 07:25
Subject:
Re: RFC 48 (v4) Replace localtime() and gmtime() with date() and utcdate()
Message ID:
20000926092520.E19139@cbi.tamucc.edu
On Tue, Sep 26, 2000 at 05:49:38AM -0000, Nathan Wiger wrote:
> =head1 NOTES ON FREEZE
> 
> Everyone felt pretty good about this, I think. The only thing we'd all
> probably like to see is one single C<date> function, but unfortunately
> dealing with timezone specifications is an extraordinarily difficult
> issue. 

I still think one of the options to the C<date()> routine could be the
offset from UTC or a code ref to a subroutine that can determine the
offset given the current UTC. That way the user could specify what
localtime means (even if it doesn't really mean local time ;-).

And, in order to make this scenario more useful, as part of the standard
Perl distribution we would have a module that defines constants for all
of the "common" timezones.

        $t1 = date(offset => -6 * 60 * 60);     # offset in seconds (CST)
        $t2 = date(offset => -5 * 60 * 60);     # offset in seconds (CDT)

        $t3 = date(offset => \&offsetsub);      # UTC passed as first
						# parameter to offsetsub()

        use Timezones;
        $t4 = date(offset => CST6CDT);                  # US/Central
        $t5 = date(offset => \&zone('US/Central'));     # US/Central

(made up syntax, of course)

-Scott
-- 
Jonathan Scott Duff
duff@cbi.tamucc.edu

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