Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: epoch time

by ikegami (Patriarch)
on Jan 31, 2007 at 17:26 UTC ( [id://597577]=note: print w/replies, xml ) Need Help??


in reply to Re^2: epoch time
in thread epoch time

I think timelocal() wants the year to be years since 1900

It accepts both.

why not set the hash up with the subtraction by one already done?

I like $m having a natural value like $d (1..~31) and $y (19xx) do. I always follow localtime and gmtime with $m++; $y += 1900;, and I always specify $m-1 for timelocal and timegm. Not seeing $m-1 raises alarms in my head.

Replies are listed 'Best First'.
Re^4: epoch time
by johngg (Canon) on Jan 31, 2007 at 20:17 UTC
    It accepts both.

    Yes, davorg also pointed out my error. I had always thought that localtime() and timelocal() were essentially mirrors of each other. Now I know better. Re. your habitual $m-1, that's very sound reasoning; perhaps I should do the same.

    I saw davorg's reply to my post just as I was leaving work so I didn't have time to correct my error. I will do so now.

    Cheers,

    JohnGG

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-23 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found