On Sun, Aug 06, 2000 at 01:41:06PM -0000, Perl6 RFC Librarian wrote:
>    $scalar  =  date;     # scalar ctime date, same as current
>    @array   =  date;     # array of date/time values (new order)
>    %hash    =  date;     # hash of date/time values (new)
>    $object  =  date;     # object with accessor functions (new)
> 
> The new C<date()> function will return time adjusted for the local
> timezone. To get UTC (or GMT, for nostalgic types) time, you simply pass
> an argument to C<date()>.

Please don't gloss over the timezone issue so easily.  There is
nothing simple about timezones (except for GMT, of course).  The
reason there are *NO* good OO date modules on CPAN is that people fail
to realize what nastiness comes from sticking in timezone support as
an afterthought.

For example, Time::Object's interface practically precludes adjusting
for daylight savings when doing date (as opposed to date/time)
arithmetic:

    #!/usr/local/bin/perl -w

    $ENV{'TZ'} = 'US/Pacific';
    use Time::Object;
    use Time::Seconds;

    print "$Time::Object::VERSION\n";

    $t = localtime 954547200;
    print $t, "\n";
    print $t - 30 * ONE_DAY, "\n";
    print $t + 30 * ONE_DAY, "\n";

=>
    add
    0.11
    Fri Mar 31 16:00:00 2000
    Wed Mar  1 16:00:00 2000
    Sun Apr 30 17:00:00 2000

Notice that adding 30 days to March 31 has the (probably unwanted)
effect of changing the time from 16:00 to 17:00.  Dates and date/times
are just entirely different beasties due to the horrible (and
senseless, btw) complexity of daylight savings time rules.

-John

Reply via email to