in reply to Re: Using timelocal function
in thread Using timelocal function

I think 732 days is a bit long for two years, even given that 1968 was a leap year. According to my math (done with DateTime), there were 731 days.

I think the reason you're getting a trailing .9583333333 days (a little under an hour) is because your date range crosses daylight savings time (which begins in March). It might also have to do with various leap seconds that have been added over the years.

In any case, I think you'd be much better off using a module to do this calculation for you (see How do I find the difference in days between two dates, in a cool perl way?). They've already been through rigorous testing for this and many other problems.

Replies are listed 'Best First'.
Re^3: Using timelocal function
by rpike (Scribe) on Feb 04, 2008 at 18:30 UTC
    According to the values I was getting back from my function the 732 added to the difference found gave me the exact numeric value that I needed. How do I "install" modules such as DateTime? I tried a few minutes earlier to put it into one of my namespaces and kept getting a CGI error back when I tried putting in use DateTime at the top of my .pl script. Thanks for the info. I'll give DateTime a try instead as the whole offset from GMT isn't too appealing.
Re^3: Using timelocal function
by Narveson (Chaplain) on Feb 05, 2008 at 07:19 UTC

    Leap Seconds

    Unix, POSIX, and Perl know nothing about the various leap seconds that have been added over the years. Personally I'm glad.

    Read all about POSIX seconds.
Re^3: Using timelocal function
by rpike (Scribe) on Feb 04, 2008 at 18:44 UTC
    Daylight savings starts in April.