Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: time difference calculation

by RMGir (Prior)
on Oct 28, 2013 at 12:36 UTC ( [id://1059971]=note: print w/replies, xml ) Need Help??


in reply to time difference calculation

You've got a simple typo (which use strict; use warnings; would have pointed out to you...)
#$end=timegm(gmtime()); #should be $end_secs=timegm(gmtime());

Mike

Replies are listed 'Best First'.
Re^2: time difference calculation
by Anonymous Monk on Oct 28, 2013 at 12:43 UTC
    D'oh! Thanks.

    That still doesn't seem correct, as I'm getting a difference of around 750 hours.

      You have a difference of 750 hours. Have you looked at the expected time difference?

      Maybe you want to study again the exact ranges of allowed input parameters for Time::Local. Especially re-read the second paragraph of the description, where the documentation draws particular attention to the allowed values for the month.

      Maybe you want to try the following dates and study the error message you get

      2013-02-31 2013-01-28 2013-01-29 2013-01-30 2013-01-31

      The month is not mapped from 01..12 for January to December but from 00..11, so that 00 means January. This explains why you get a difference in time of 31.25 days.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-25 13:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found