Overdue Library Book



  •  Saw this today:




  • It looks like yet another programmer forgot to check his return codes before displaying the result.



  • Heh. Looks like a -1 on a datetime format using the 1900 epoch.

    Though I laughed even more with a lot of sites (and some BBS's) that used 2-digit dates. Their own "Y2K" bug consisted in 2000 being marked as 100, 2001 as 101 ... so you'd find stuff like Last logged in on 13/02/106.



  • I saw websites LAST YEAR that still had this buggy code displaying the incorrect year on the front page!  And one of them wasn't long-dead, as you'd expect.  I'm imagining a small company, no one with Javascript or even basic HTML experience, and too cheap to hire a consultant. 



  •  Heh, obviously a beginner's mistake - programmer must've been a newbie...



  • @danixdefcon5 said:

    Though I laughed even more with a lot of sites (and some BBS's) that used 2-digit dates. Their own "Y2K" bug consisted in 2000 being marked as 100, 2001 as 101 ... so you'd find stuff like Last logged in on 13/02/106.

    I see a lot of that with sites written in Perl. Does anyone know why on Earth Perl returns the year minus 1900?



  • Despite this one obviously being a programming error, books being overdue by more than 100 years are not unheard of.

    1. http://chronicle.uchicago.edu/980319/book.shtml
    2. http://news.bbc.co.uk/1/hi/scotland/3696750.stm


  • @operagost said:

    I saw websites LAST YEAR that still had this buggy code displaying the incorrect year on the front page!  And one of them wasn't long-dead, as you'd expect.  I'm imagining a small company, no one with Javascript or even basic HTML experience, and too cheap to hire a consultant. 

     

    Yes, because consultants can fix anything and they never introduce WTFs of their own...



  • @Cap'n Steve said:

    @danixdefcon5 said:
    Though I laughed even more with a lot of sites (and some BBS's) that used 2-digit dates. Their own "Y2K" bug consisted in 2000 being marked as 100, 2001 as 101 ... so you'd find stuff like Last logged in on 13/02/106.

    I see a lot of that with sites written in Perl. Does anyone know why on Earth Perl returns the year minus 1900?

     

    I always assumed that it was because C does it this way.  According to the C specs, tm_year is defined as the number of years since 1900.  Now, what I always hate is forgetting that that month (tm_mon) is represented as 0 through 11, not 1 through 12.  Anybody know why this is the case?



  • @WeatherGod said:

    Now, what I always hate is forgetting that that month (tm_mon) is represented as 0 through 11, not 1 through 12.  Anybody know why this is the case?

    Because C is essentially thinly-veiled assembly and programmers can't get away from the goddamn zero-based sequence idiom. 



  • @WeatherGod said:

    I always assumed that it was because C does it this way.  According to the C specs, tm_year is defined as the number of years since 1900.  Now, what I always hate is forgetting that that month (tm_mon) is represented as 0 through 11, not 1 through 12.  Anybody know why this is the case?
    Clearly it's defined as the number of months since January.



  • >  Heh. Looks like a -1 on a datetime format using the 1900 epoch.

     

    Well that settles it...   <a href="http://xkcd.com/376/">Epoch Fail</a>

     



  •  Nice.  Guess I need an HTML refresher...oh well...



  • @WeatherGod said:

    I always assumed that it was because C does it this way.  According to the C specs, tm_year is defined as the number of years since 1900.  Now, what I always hate is forgetting that that month (tm_mon) is represented as 0 through 11, not 1 through 12.  Anybody know why this is the case?

    Zero-based system. The funny thing is that it only applies to the month, and not to the day of month. I find it kind of funny, as usually the OS's epoch is 1970, though I think that a negative time value would cover dates under 1970.


  • @bstorer said:

    @WeatherGod said:
    I always assumed that it was because C does it this way.  According to the C specs, tm_year is defined as the number of years since 1900.  Now, what I always hate is forgetting that that month (tm_mon) is represented as 0 through 11, not 1 through 12.  Anybody know why this is the case?
    Clearly it's defined as the number of months since January.

    And they couldn't stick with that logic when defining tm_mday (which has range 1 through 31)?  I mean, they did it for tm_yday [0, 365], and tm_wday [0, 6].  Everything else in the list is zero-based.  For the time parts, that makes sense.  For the year, month and day parts, it sort of makes sense, but only because it is explicitly defined that way.



  • @operagost said:

    I saw websites LAST YEAR that still had this buggy code displaying the incorrect year on the front page! 

     

    You can find plenty of 'em still going with a google search for "June 19108"


  • @WeatherGod said:

    According to the C specs, tm_year is defined as the number of years since 1900.  Now, what I always hate is forgetting that that month (tm_mon) is represented as 0 through 11, not 1 through 12.  Anybody know why this is the case?

     

    It's so you can have a 12 element char* array of the month names (array indexes start at 0 of course), without wasting a sizeof(char*) chunk of memory for an unused array element 0. Same for tm_wday and a char* array of weekday names.



  • @danixdefcon5 said:

    Heh. Looks like a -1 on a datetime format using the 1900 epoch.

    Though I laughed even more with a lot of sites (and some BBS's) that used 2-digit dates. Their own "Y2K" bug consisted in 2000 being marked as 100, 2001 as 101 ... so you'd find stuff like Last logged in on 13/02/106.

    SyncEdit still does say something like "26 Jun108" instead of the correct date, it is a editor used in Synchronet and Synchronet is still being used today (I sometimes log in to X-BIT to play Word Warp or sometimes for other reasons as well). They know about the Y2K bug.
    [code]Y2K Patch
    ~~~~~~~~~
    There is a Y2K bug in all known versions of SyncEdit where the year 2000 is
    displayed as 100, causing the status bar to wrap and making the program
    unusable. I've released a group of binary-edited SyncEdit executables (for
    all located versions) that works around this problem: the year is still
    displayed as 100, but the status bar no-longer wraps. The file that includes
    these patched files is SYEDTY2K.ZIP and can be downloaded via Telnet/Zmodem or
    FTP from vert.synchro.net.[/code]

Log in to reply