Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: DateTime::Format::Strptime Parsing Seems to have a Problem?

by ozboomer (Friar)
on Mar 31, 2019 at 00:35 UTC ( [id://1231912]=note: print w/replies, xml ) Need Help??


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 (Bishop) 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1231912]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-03-29 13:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found