in reply to Re: setting TZ causes Date::Manip to report incorrect time
in thread setting TZ causes Date::Manip to report incorrect time
Does this mean that Date::Manip has problems with timezones, as BigLug suggests? i think the docs, rather than the code, are the problem. it would be interesting to see a proper comparison of DateTime functionality with Date::Manip; i would be surprised if Date::Manip came off worst:
Well, as someone who's used every datetime module under the sun, and then got sick of them and wrote DateTime, I wouldn't be surprised if Date::Manip came off worse, because I know that it will.
Specifically, try doing this with Date::Manip:
my $dt1 = DateTime->new( year => 2003, month => 5, day => 2, hour => 7, minute => 53, time_zone => 'Asia/Tokyo' ); my $dt2 = DateTime->new( year => 2003, month => 5, day => 2, hour => 5, minute => 53, time_zone => 'Asia/Calcutta' ); if ( $dt1 > $dt2 ) { ... } else { ... } $dt1->set_time_zone( 'Asia/Calcutta' ); print $dt1->datetime, "\n"; print $dt2->datetime, "\n";
If that sort of thing is even possible with Date::Manip, it'd be much, much, much more code.
Date::Manip can alter the number of seconds in the day via "WorkDayBeg" and "WorkDayEnd" in Date_init() (see above), so it, at least, does not suffer from making the assumption that there are 24*60*60 seconds in a day.
What BigLug was referring to when he mentioned this was the existence of leap seconds, not the idea of "business hours". Some days last longer than 24*60*60 seconds on the clock, according to the UTC system. However, this only happens to one day every couple years or so. You can't simply change the length of the day and leave it at that. That would be quite broken.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: setting TZ causes Date::Manip to report incorrect time
by Anonymous Monk on Mar 11, 2022 at 06:57 UTC | |
Re: Re: Re: setting TZ causes Date::Manip to report incorrect time
by wufnik (Friar) on Sep 10, 2003 at 22:16 UTC |