Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
DateTime uses Int timezone offsets. #130
As it says on the box, DateTime now uses Int for timezone offsets, and no longer supports Callable objects for timezone offsets. $*TZ is now an integer value representing the offset from UTC in seconds.
This also resolves the long-standing bug with regards to properly setting the offset for negative timezones.
As perlpilot mentioned, the offset is in seconds, so it handles all those cases. There are courtesy methods for retrieving the offset in hours or minutes if so desired. I will be writing a DateTime::TimeZone library, inspired by the Perl 5 library of the same name, which can be used to do something like:
my $tz = tz-offset('+0545');
Which will eliminate the need to know the value in seconds.
Right, seconds not hours. That should be enough for most purposes. Thanks for the clarification!
Pre-standardisation of timezones, times usually refer to local solar time, I think, but that's sufficiently esoteric to be relegated to a module, I should think.