Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Perl is v5.8.3 built for PA RISC 1.1.
Machine is HP superdome with at least 15 processors assigned and min 10Gb of memory.
Time::Local version is 1.07

Time::Local returns invalid results for Sept. 2004. All of the bad returns have a $pmon value of 8 and $pyear value of 104. Only the first call using a date in September 2004 is returned correctly. All other bad returns are for different dates within the same year and month. Incorrect values are consistant as far as I can tell. This bug appeared after a system & perl version upgrade. Code worked for years without error on older version of Perl & HP/UX. We are currently running the latest version of PERL suppored by HP.

Here is the code as running:

#get seconds for login time supplied print "values sent to time local 1:1:1:$pday:$pmon:$pyear"; use Time::Local; $pepoch=timelocal(1,1,1,$pday,$pmon,$pyear); print " return value is $pepoch\n";

Here is an example of the results...
First the good call for Sept with 2 surrounding data lines:
values sent to time local 1:1:1:01:0:100 return value is 946706461
values sent to time local 1:1:1:30:8:104 return value is 1096520461
values sent to time local 1:1:1:05:4:105 return value is 1115269261
Next the first bad call with surrounding data:
values sent to time local 1:1:1:05:6:101 return value is 994309261
values sent to time local 1:1:1:02:8:104 return value is 194461
values sent to time local 1:1:1:14:2:102 return value is 1016085661
Lastly, here is a section of bad dates that fall next to each other:
values sent to time local 1:1:1:07:3:105 return value is 1112850061
values sent to time local 1:1:1:26:7:104 return value is 1093496461
values sent to time local 1:1:1:02:8:104 return value is 194461
values sent to time local 1:1:1:16:8:104 return value is 1404061
values sent to time local 1:1:1:16:8:104 return value is 1404061
values sent to time local 1:1:1:16:8:104 return value is 1404061
values sent to time local 1:1:1:16:8:104 return value is 1404061
values sent to time local 1:1:1:05:4:105 return value is 1115269261
values sent to time local 1:1:1:23:8:104 return value is 2008861
values sent to time local 1:1:1:05:4:105 return value is 1115269261
values sent to time local 1:1:1:09:11:104 return value is 1102572061
Someone mentioned a caching issue sounds which sounds like a possibility. I think in some earlier testing that I was able to remove all errors by moving the data lines that returned bad values to earlier locations in the data file. The the question becomes how would I track what is causing the cache error. I think the Time::Local version I have is the most current supported one for HP/UX. The other issue is that the over 1000 other calls come back correct.

One of the replies suggested I not use 1,1,1 due to DST. I am using 1,1,1 only because I require age in number of days. This still could be a possibility, but the error is for the month of September and the DST change takes place in October.
Thanks for amy help.
mike<r>

Replies are listed 'Best First'.
Re: TIME::LOCAL problem - repost with better info
by tphyahoo (Vicar) on May 19, 2005 at 08:48 UTC
    Can you post a link to your earlier troubleshooting attempts on perlmonks or elsewhere?

    What version of time::local are you using?

    Did you try make test on it?

    Can you make a script that will duplicate the problem, for your system as it is running *now*?

    Can you include comments, and format the output to be more understandable for those not familiar with time::local? As it stands now, it's not really clear why your "bad" output is bad to me.

    Can you solve the whole problem by using one of the other time oriented modules, like localtime?

    Good luck.

      Answers:

      First post was http://www.perlmonks.com/?node_id=454853

      As included in the post Time::Local is 1.07
      Production box with HP supplied perl. Did not compile perl on this device.

      The code listed is the actual code running. The only change from production was to print the values to document the problem.

      Time::Local takes the six parameters listed in the output as values sent and returns date & time in number of seconds. Return value from time local is the number of seconds returned from each time::local call. All dates are within five years of each other so returned values should be within around 157680000 seconds of each other (5 years worth of seconds). The difference between the first bad return value and the data prior is 994114800 seconds.

      Due to business requirements, I can only use modules included from HP.
      thanks
        Do these business requirements mean you can't upgrade to the latest Time::Local version -- 1.11? Might be worth a shot.