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

Re: The Y2.001775K Bug

by Cybercosis (Monk)
on Apr 19, 2001 at 06:32 UTC ( #73726=note: print w/replies, xml ) Need Help??

in reply to The Y2.001775K Bug

I see that we're coming up to a major rollover for the UNIX 32-bit clock on Sept 9, 2001, in which we go from 999999999 to 1000000000.

Not to sound rude, but this is incorrect. At the stated date, the UNIX clock will read 987654321. The "big" rollover doesn't occur until 2038.


Replies are listed 'Best First'.
Much ado about time_t
by yakko (Friar) on Apr 19, 2001 at 06:44 UTC
    This "rollover," while still within the 32-bit signed space of a time_t, will indeed happen on 09.09.2001 ... 987654321 is scheduled to hit tomorrow sometime (today at 23:25:21 CDT)

    Me spell chucker work grate. Need grandma chicken.

Re: Re: The Y2.001775K Bug
by jepri (Parson) on Apr 19, 2001 at 06:44 UTC
    masem didn't actually mean a rollover - I think he was just using it as an analogy He meant "we're coming up to a point where all the nines go to zeros and we put a one in front".

    I'm not quite sure what he means by check your string comparisons, because I can't see a way that it could change the outcome of a string comparison unless you were doing something terribly foolish like

    if (substr($this_dat,0,4) eq substr($that_date,0,4) {

    In which case it would come up false when you clearly would have wanted it to be true.

    It was an interesting snippet anyway, just like yakko's below.

    I didn't believe in evil until I ate it.

      Here's a possible way that you can run into this blunder, a good possible 'newbish' problem.
      # Generate files... my $time = time(); open FILE ">$time.txt" or die $!; print FILE $stuff; close FILE; # this is repeated often, as from CGI... # # Retrieval now... my @files = get_list_of_files(); @files = sort { $a cmb $b } @files; foreach my $file ( @files ) { do_something_with_file ( $file ); }
      If the files are created across the 9/9/01 boundary, you are going to missort these later.

      Oddly enough, I use this exact technique in my recent code snippet,; however, I do protect from this by sprintf'ing the time into a much much longer string that should be ok until 64-bit systems...without that sprintf, that code suffers from the same problem.


      Dr. Michael K. Neylon - || "You've left the lens cap of your mind on again, Pinky" - The Brain

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2022-12-08 21:57 GMT
Find Nodes?
    Voting Booth?

    No recent polls found