houseabsolute / DateTime-TimeZone

Time zone object base class and factory
https://metacpan.org/release/DateTime-TimeZone/
Other
9 stars 25 forks source link

Warning due to mismatched timezone db versions is inaccurate #11

Open autarch opened 7 years ago

autarch commented 7 years ago

Migrated from rt.cpan.org #66097 (status was 'new')

Requestors:

From ether@cpan.org (@karenetheridge) on 2011-02-23 23:35:47:

I just updated DateTime::TimeZone today (to 1.28); there was a process already running in the background that uses DateTime::TimeZone, and this warning appeared in my logs:

Loaded DateTime::TimeZone::Europe::Rome, which is from an older version (2011b) of the Olson database than this installation of DateTime::TimeZone (2010j).

No doubt this is because using the timezone object checks the db on disk, which was updated to a newer version than the version of the TZ module running in memory -- so I'm not worried about the fact that I got this warning. However, the message is inaccurate - it says "older" when in fact this version is newer. The code reveals:

    if ( $object_version ne $catalog_version ) {
        warn
            "Loaded $real_class, which is from an older version

($object_version) of the Olson database than this installation of DateTime::TimeZone ($catalog_version).\n"; }

This is an equality check, rather than a gt/lt comparison. I would suggest either altering the error message to say "from a different version", or not warning at all if the db is newer than the code (I'm not sure if it is useful to warn in this case or not).