Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re: 2038 bug

by pg (Canon)
on Apr 11, 2003 at 05:10 UTC ( #249808=note: print w/ replies, xml ) Need Help??


in reply to Re: 2038 bug
in thread 2038 bug

he cannot really fix it on his own. Try this: on your PC, set date to 01-01-2039, by doing this:

date 01-01-2039
then run this perl program:
print time();
you will get a negative number back. That's the limitation sort of thing, not a bug in his code. Try this code:
print time(); # set time to 01-01-2038 before try this code print(2 ** 31 - 1);
Look at how close those two numbers are, now you realize that's the up limitation of positive integers on 32 bit machine.

I don't worry about this too much, most likely when 2038 approaches, 64 bit or something even better will dominate.

(Set time to 2038-01-18-20:14:06, and see what happens to the above demo, also 2038-01-18-20:14:07)


Comment on Re: Re: 2038 bug
Select or Download Code
Re: Re: Re: 2038 bug
by Anonymous Monk on Apr 11, 2003 at 05:24 UTC

    Thanks for the correction, the thought had crossed my mind, but I didn't think we were anywhere near that close (guess I should do my math next time ;). time to dust off the ol' quantum computer, only 35 years to get it working! :)

      you forget that it is not necessary to be exactly at some date to deal with. Any operations with future dates should be possible.
      Or may be you're surprised by long-time credits and calculating percents on the sum? Calculations of pension?

      Courage, the Cowardly Dog

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (14)
As of 2014-07-10 20:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (215 votes), past polls