in reply to Re: DateTime::Format::Strptime Parsing Seems to have a Problem?
in thread DateTime::Format::Strptime Parsing Seems to have a Problem?

Right you are, ikegami... but the use of the code:

our $LocalTZ = DateTime::TimeZone->new( name => 'local' ); my $dtnow = DateTime->now(time_zone => $LocalTZ);

...seems to be a practice that many folks follow, mainly in the interests of performance and consistency.

The details are discussed in the DateTime module docs under the heading "Determining the Local Time Zone Can Be Slow".

Replies are listed 'Best First'.
Re^3: DateTime::Format::Strptime Parsing Seems to have a Problem?
by hippo (Archbishop) on Mar 31, 2019 at 12:23 UTC
    mainly in the interests of performance

    If you are going to use $LocalTZ more than once then storing the DateTime::TimeZone object as a variable has a performance benefit. Conversely if you are going to use it only the once then there's likely to be a (very small) performance penalty.