Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: 2038 bug

by Anonymous Monk
on Apr 11, 2003 at 05:03 UTC ( #249807=note: print w/replies, xml ) Need Help??

in reply to 2038 bug

Why not just fix it? Post the code, we'll help out, honest.

Replies are listed 'Best First'.
Re: Re: 2038 bug
by pg (Canon) on Apr 11, 2003 at 05:10 UTC
    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)

      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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://249807]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2018-02-23 17:29 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (306 votes). Check out past polls.