Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Re: Converting between localtime scalar and list contexts

by cforde (Monk)
on Jun 06, 2001 at 01:13 UTC ( [id://86017]=note: print w/replies, xml ) Need Help??


in reply to Re: Converting between localtime scalar and list contexts
in thread Converting between localtime scalar and list contexts

A warning on doing this kind of thing. Notice that bikeNomad determined the time only once; the other time values are based on it. That's very important 'cause if you do it this way:
my $time = time; my $ctime = localtime; my @timeArray = localtime;
which might seem more "natural", you leave yourself open to a very subtle and obsure bug: What if the second changes between one of those calls? It might look like an "off-by-one" error, but it only happens "sometimes". Maybe nothing serious happens. But what if midnight occurs between one of those calls? Depending on what you're doing with @timeArray and $ctime you will get inconsistent results. This could hurt. I have seen it happen.

Have fun,
Carl Forde

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-26 06:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found