[lug] Perl and large numbers on (K)ubuntu

Gary Hodges Gary.Hodges at noaa.gov
Wed Sep 28 10:14:43 MDT 2011


On 09/27/2011 03:45 AM, Anthony Foiani wrote:
> Gary Hodges<Gary.Hodges at noaa.gov>  writes:
>
>> Thank you for the reply.  Here is a short program that shows what I am
>> describing.
>> ----------
>> #!/usr/bin/perl
>> use Date::Manip;
>> my $secs = 2147483647;  # Increment by one to see the error
>> my $time =&DateCalc("Jan 1, 1900  00:00:00","+ $secs");
>> print "$secs $time\n";  # $time is in yyyymmddhh:mn:ss format
>>
>> # My output (second line is w/secs incremented by one):
>> # 2147483647 1968012003:14:07
>> # 2147483648 1831121320:45:56
>
> I can't guarantee this will work, but from my experiments, it looks
> like it's an issue with representing the delta as a string.
>
> Please take a look at:
>
>     http://scrye.com/~tkil/perl/date-time-bigint.plx

Thank you for posting the example code.  I was able to use a chunk of it 
to get things going.

Gary



More information about the LUG mailing list