• Chelloveck (unregistered) in reply to Anonymous
    Anonymous:
    I really hope the Unix timestamp overflow of 2038 proves more eventful. Of course, even if it's an extinction-level event we'll never convince the world to give a shit after we called wolf over Y2K. "Another Y2K? Oh noes, that was so bad the last time, LOL!!! Here, I annotated a cat to reflect my deep concern about this most serious event, ROFL!1!"

    Don't worry about it. With the 99942 Apophis impact scheduled for 2036 we'll neatly and conveniently not have to concern ourselves with date rollover issues for a long time... At least not until we rebuild all the way up from the stone age again.

  • Gilbert (unregistered) in reply to Tim
    Tim:
    note for US citizens: other countries really do exist, and some of them even have computers
    OK you correctly identified a couple top problems
    1. Other countries exist
    2. They have computers

    but you missed

    1. Graphical interfaces let people who have no business touching computers think they can
  • Dazed (unregistered) in reply to Andrew
    Andrew:
    Lest we perpetuate the myth that Y2K was no big deal, allow me to relate a tale from the trenches...
    I know of a medium-sized financial company that spent the first three working days of 1998 dead in the water - unable to execute any business whatever - because of a couple of lines of code that looked ahead two years. The number of lines of code that eventually needed to be fixed was in the tens of thousands.
  • FuBar (unregistered) in reply to EmperorOfCanada
    EmperorOfCanada:
    To me this is only a minor WTF. I am sure that if you had perfect knowledge of boost and, of course, the stdlib that you could replace 60% of my code. Throw in a few other libraries and it could shrink down some more.
    Software development is not so much about learning algorithms any more. It's mostly about memorizing your object model, class libraries, etc., so you can program more efficiently (faster with fewer errors). It's less about being clever and more about being a good memorizer. In fact, god save us from clever programmers - their code is too hard to debug. KISS.
  • rfoxmich (unregistered)

    ..when all they really had to do was to algorithmically capture one of those graphical perpetual calendars like...say: http://en.wikipedia.org/wiki/File:P%C3%A5sktavla_ur_Liljegrens_Runl%C3%A4ra_(ur_Sverige_Runinskrifter).png

  • caper (unregistered)

    I've been looking at a legacy system for a replacement.

    Turns out that the original designer stored dates as integers and the application didn't enforce any date checking.

    The impossible dates such as April 31 I can handle by setting to the first of the next month. But it turns out that sometimes people input dates as y-m-d and sometimes y-d-m.

    I guess that if nobody has cared about work being logged too early or too late then I'll just take the data as it is.

  • Stux McCoy (unregistered) in reply to FuBar

    Some of us know what readable code is. For example:

    if (! ($a = ($b=getResult($c)) ? (!floor($d/2)==$d/2) : $e^45) ) { // do something doSomething($a); }

    This could be easily worded as "if the assignment of a as the result of b getting a result from passing c to getResult check to see that d is an even number and negate or else e to the 45th exponent negated then DoSomething with the result stored in a".

    Look at how much I accomplished with a single line of code!

  • publiclurker (unregistered) in reply to Matthew

    One of our commercial products takes daylight-saving time into account. A few years ago when the decided to change the dates for DST, we had to make a new release to support the changes. Even though the engineers knew the change was temporary, they replaced the old hard coded dates with new, hard coded ones. That way we needed to re-release a new version once again when the law expired.

  • Wuest (unregistered)

    More so than any other line of code, I believe that

    ElseIf (dayInt > 29 And yearInt Mod 4 = 0) Then
    describes the skill of our beloved developer best.

    CAPTCHA: abigo. Y2K was indeed abigo problemo.

  • qbolec (unregistered)

    TRWTF are:

    • the IsDate function http://msdn.microsoft.com/en-us/library/00wf8zk9(VS.80).aspx#Y300 which accepts dates, as well as "3:45 PM"
    • people who did not bother reading the documentation of this function even though it was linked in the story, but yet claim that other people are too lazy to use google
    • that original code missed the case year = 100, which is either a bug, or business requirement for some artificial date, or even better: a way to pass a unit test
    • that original code accepted year to be either single digit or four-digits, which clearly indicates that someone had a stupid business requirement to be able to enter a year using single digit (that was a lazy guy!), which to eliminate ambiguity forced the developer to accept only dates from range [2000,2010).
    • that somebody filed the bug before the year 2010 came in, which indicates, that they actually were using dates from the future and were aware of the bug, yet did not solve the problem earlier
    • the developer did not use regexp
    • the developer implemented an algorithm for leap years that is correct in the range [2000,2010), but instead of using assertion he just marks years outside this range as bad
    • one of the if conditions contains "and year mod 4 = 0" just to make you think about other possibilities...
  • Shlomo (unregistered) in reply to Matthew
    Matthew:
    Update the code once a year? No problem. I once had to fix an application whose strategy for dealing with daylight-saving time was for the code to be changed every six months.

    Until recently in Israel, the specific dates when DST started and ended for any year was decided by the Ministry of the Interior. Because of the company's schedule, sometimes it took effect when we weren't open and we'd have to enact it retroactively! Talk about a huge headache.

  • qbolec (unregistered) in reply to Stux McCoy
    Stux McCoy:
    e to the 45th exponent
    I thought you write it 1e+45 :)
  • (cs) in reply to Ken B.
    Ken B.:
    And let's not forget that 2000 was a leap year, being the exception-to-the-exception. Back in Y2K-n, we got several bug reports stating that our IsLeap() function returned TRUE for 2000. (Apparently, more than one companies' Y2K-compliance tests were buggy.)

    Oh, did you work for DEC^WCompaq^WHP^WWhatever-they're-called-today?

    http://h71000.www7.hp.com/openvms/products/year-2000/leap.html

  • Ville (unregistered)

    This article made me want to quote Tyler Durden: "Why would anybody want this shit job?"

  • (cs) in reply to rfoxmich
    rfoxmich:
    ..when all they really had to do was to algorithmically capture one of those graphical perpetual calendars like...say: [image]

    Sure. All you need now is a Runes recognition library.

  • (cs) in reply to Gilbert
    Gilbert:
    Tim:
    note for US citizens: other countries really do exist, and some of them even have computers
    OK you correctly identified a couple top problems
    1. Other countries exist
    2. They have computers

    but you missed

    1. Graphical interfaces let people who have no business touching computers think they can

    • With a name like Tim, you're probably from Canada, which is just like the US. Tim Horton's anyone?

    • We don't care about any other countries and their little problems.

  • Pot-ah-to Pot-ay-to (unregistered) in reply to qbolec
    qbolec:
    TRWTF are: * the IsDate function http://msdn.microsoft.com/en-us/library/00wf8zk9(VS.80).aspx#Y300 which accepts dates, as well as "3:45 PM" * people who did not bother reading the documentation of this function even though it was linked in the story, but yet claim that other people are too lazy to use google * that original code missed the case year = 100, which is either a bug, or business requirement for some artificial date, or even better: a way to pass a unit test * that original code accepted year to be either single digit or four-digits, which clearly indicates that someone had a stupid business requirement to be able to enter a year using single digit (that was a lazy guy!), which to eliminate ambiguity forced the developer to accept only dates from range [2000,2010). * that somebody filed the bug before the year 2010 came in, which indicates, that they actually were using dates from the future and were aware of the bug, yet did not solve the problem earlier * the developer did not use regexp * the developer implemented an algorithm for leap years that is correct in the range [2000,2010), but instead of using assertion he just marks years outside this range as bad * one of the if conditions contains "and year mod 4 = 0" just to make you think about other possibilities...

    You forgot the fact that all months start with day 0.

  • Simon (unregistered) in reply to caper
    caper:
    I guess that if nobody has cared about work being logged too early or too late then I'll just take the data as it is.

    If they don't know whether the dates are y-m-d or y-d-m, then they have no idea what they mean now, never mind what they mean once migrated into a new system...

  • (cs)

    So, have we gotten past the whole "VB is TRWTF" thing yet?

    Have I marked this comment for deletion?

  • Gunslinger (unregistered) in reply to Me
    Me:
    Valid Comment?

    File Not Found

  • Gunslinger (unregistered) in reply to Anonymou5
    Anonymou5:
    The original code is more robust. The last one might not work, because dates could be implemented differently on different platforms, so the function might not always return the correct result. It's much better to code it yourself, just to be sure.

    Captcha: genitus Definition: Someone who thinks with his reproductive organ, but does a very good job of it.

    It only takes 6 weeks after all.

  • (cs) in reply to Anonymou5
    Anonymou5:
    The original code is more robust. The last one might not work, because dates could be implemented differently on different platforms, so the function might not always return the correct result. It's much better to code it yourself, just to be sure.

    Captcha: genitus Definition: Someone who thinks with his reproductive organ, but does a very good job of it.

    Confirmed! 29/02/2008 and 02/29/2008 are both valid dates for the IsDate function whereas the original version only allows the mm/dd/yyyy format.

  • (cs)

    TRWTF is a bool function with a VARIANT type.

  • (cs) in reply to frits
    frits:
    rfoxmich:
    ..when all they really had to do was to algorithmically capture one of those graphical perpetual calendars like...say: [image]

    Sure. All you need now is a Runes recognition library.

    I actually created a date library based on the ancient Babylonian version of the above.
  • (cs) in reply to Spivonious
    Spivonious:
    Is it just me, or will that function fail on any date after 2010?

    Why?

  • Lorens (unregistered) in reply to Spivonious

    Well, it's just you and a lot of other people, excluding the programmer. That's kind of the point.

    This kind of thing happens in lots of places, some not so obscure: SpamAssassin managed to insert a check that the year of a mail was of the form 200[0-9], AND misdocument it, AND when discovered in january 2010 just change to expire in 2020 instead ... all that just beside the other function that checks that the date is not too far in the past -- that function manages to compare to the day's date!

    https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6269

  • Gunslinger (unregistered) in reply to publiclurker
    publiclurker:
    One of our commercial products takes daylight-saving time into account. A few years ago when the decided to change the dates for DST, we had to make a new release to support the changes. Even though the engineers knew the change was temporary, they replaced the old hard coded dates with new, hard coded ones. That way we needed to re-release a new version once again when the law expired.

    That's called job security. They should get a bonus.

  • (cs) in reply to Jellineck
    Jellineck:
    I don't think that will give them what they are looking for.

    IsDate("1a") will return true.

    They will also have to check thisDate > 1 to know whether that is actually a valid date.

    If (slashCount <> 2) Then
        CheckValidDate = False
    End If
    
  • Vinny (unregistered) in reply to Abso

    Not all of the boxes were on the same version of dst (thanks Congress!). Nor did the installers make a note of which firmware was in use. The work around was to change an offset variable in a table if a box was late with its data on any of the four (thanks again Congress!) dst changeover dates.

  • quisling (unregistered)

    Inconvenience?!?

    More like "license to print money!"

    Y2K issues were a windfall, if you knew what you were doing in 1999.

    Seriously, 2 pages of comments, and not one consultant sounding off here?

    Sorry for your lots, y'all. I made out like a bandit!

    grin

  • (cs) in reply to dohpaz42
    dohpaz42:
    Andrew:
    ... Y2K was a non-event only because of the long hard work of thousands of dedicated people like that.

    Don't worry, we'll get to go through it all over again in 2038: http://en.wikipedia.org/wiki/Year_2038_problem

    If only we had the foresight and technology to fix it now...

    Well, on 32-bit machines you ave a problem, indeed. A "bigint" is certainly not so easy to implement there.

  • Ram Sadiq Ravishankar Vishnu (unregistered) in reply to frits
    frits:
    Gilbert:
    Tim:
    note for US citizens: other countries really do exist, and some of them even have computers
    OK you correctly identified a couple top problems
    1. Other countries exist
    2. They have computers

    but you missed

    1. Graphical interfaces let people who have no business touching computers think they can

  • With a name like Tim, you're probably from Canada, which is just like the US. Tim Horton's anyone?

  • We don't care about any other countries and their little problems.

  • 6. Or their funny little names.
  • anon (unregistered) in reply to Lorens
    Lorens:
    Well, it's just you and a lot of other people, excluding the programmer. That's kind of the point.

    This kind of thing happens in lots of places, some not so obscure: SpamAssassin managed to insert a check that the year of a mail was of the form 200[0-9], AND misdocument it, AND when discovered in january 2010 just change to expire in 2020 instead ... all that just beside the other function that checks that the date is not too far in the past -- that function manages to compare to the day's date!

    https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6269

    /facepalm

    I love how one of the first comments on there is something along the lines of "yes, the new fix will break in ten years, but we have years to fix it!"

  • Anonymous Coward (unregistered) in reply to qbolec

    And of course:

    • it will accept arbitrarily many leading zeros
    • it will accept a day of zero.

    So, 31/00/02010 appears to be valid.

  • (cs) in reply to Anonymous Coward
    Anonymous Coward:
    And of course: * it will accept arbitrarily many leading zeros * it will accept a day of zero.

    So, 31/00/02010 appears to be valid.

        If (monthInt < 1 Or monthInt > 12) Then
            CheckValidDate = False
    
  • (cs) in reply to Nagesh
    Nagesh:
    Today my time machine got stuck. So I was not able to enter a comment in time. None of the input functions were operational, so I had to reboot my time machine twice.
    FTFY
  • (cs)

    I really liked this the best:

    If ((myAsc < 47 Or myAsc > 57) And myAsc <> Asc("/")) Then
    

    It's a triple WTF.

    First, the range of 47 through 57 is obviously intended to pass only digits, but in ASCII, the digits are 48 ('0') through 57 ('9'). So this would pass a "bad character" ...

    ...except that 47 happens to be the slash ('/'). Which means that, with translation, this boils down to:

    If ((thisChar < "/" Or thisChar > "9") And thisChar <> "/") Then
    

    ...but wait: This can further be written (English) as, "If this character is (not (either a slash or digit)) and (not a slash) then.

    It's like it was programmed by Inspector Gadget ... it only works for any date by accident.

    I nominate a new code category with this as the type case: Inspector Gadget code.

  • Allan Olesen (unregistered)

    If ((myAsc < 47 Or myAsc > 57) And myAsc <> Asc("/")) Then

    myAsc < 47 Or myAsc > 57) 11 different allowed characters in this check

    myAsc <> Asc("/") 1 allowed character in this check

    Total: 12 different allowed characters.

    Unless...

  • (cs)

    Y2K was a "minor" event because millions of dedicated programmers fixed the bugs ahead of time. I spent much of the summer of 1998 fixing Y2K bugs in all our company's code; when 2000/01/01 came it all worked perfectly.

  • filmil (unregistered)

    I wonder how interesting the daily WTF articles would be if people just wrote unit tests for their code.

    You could, for example, have a unit test that takes a date of "now() + 1 year" and tests all the date-fiddling functions with it. This test has a sliding lookahead window and will start failing 1 year before the code becomes a problem.

    So if there indeed is a date handling error, you'd have the whole year to fix it.

  • foo (unregistered) in reply to frits
    frits:
    Gilbert:
    Tim:
    note for US citizens: other countries really do exist, and some of them even have computers
    OK you correctly identified a couple top problems
    1. Other countries exist
    2. They have computers

    but you missed

    1. Graphical interfaces let people who have no business touching computers think they can

  • With a name like Tim, you're probably from Canada, which is just like the US. Tim Horton's anyone?

  • We don't care about any other countries and their little problems.

  • Points 4. and 5. are really the same. 4. actually made me LOL (and I'm sure it wasn't intentional on your part).
  • foo (unregistered) in reply to OldCoder
    OldCoder:
    Amen to that. Fixed an interesting one myself on a 3rd party control library.

    Put in 1999 and then increment it by one (for some reason to do with validation; I forget) what do you think the answer was? Yup, that's right, 3000.

    Go figure.

    I figure it was written by Philipp J. Fry.

  • (cs)

    Certainly this developer's code could be improved upon, but calling the .NET framework directly like this can also be problematic and result in "vendor lock-in" to .NET.

    Personally, and this is what I tell all of the developers on my team to do, is if you are going to use a framework function, you should really wrap it in your own library. Over the years I have built up quite a large wrapper library that insulates me from the whims of Microsoft when they decide to change a framework function. This is the way Microsoft intended you to use the .NET framework, which is quite low-level. You really should not let client's call it directly.

    Chaining calls together like this is what gives you a nice, scalable n-Tier design, but that discussion is left for another day.

  • Abso (unregistered) in reply to filmil
    filmil:
    I wonder how interesting the daily WTF articles would be if people just wrote unit tests for their code.

    You could, for example, have a unit test that takes a date of "now() + 1 year" and tests all the date-fiddling functions with it. This test has a sliding lookahead window and will start failing 1 year before the code becomes a problem.

    So if there indeed is a date handling error, you'd have the whole year to fix it.

    What makes you think that the original programmer, who used hard-coded dates in the date handling function, wouldn't also use hard-coded dates in the unit test for the date handling function?

  • Son Of Thor (unregistered) in reply to Bellinghman

    (The programmer in question is scrupulous in following that, using only syntax that will work in vanilla C)

    And wrap a few #ifdefs around some blocks of code and you have cross platform code.

    Sad fact but sometimes you just have to do it this way

  • Doug (unregistered)

    My favourite part was:

    If ((yearInt > 10 And yearInt < 100) Or (yearInt > 100 And yearInt < 2000) Or (yearInt > 2010)) Then CheckValidDate = False
    i.e. years can be valid in the ranges -infinity to 9, exactly 100, or 2000 to 2009.

    This guy doesn't know the difference between "<" and "<=".

  • Mark (unregistered) in reply to Coyne

    I think there's already a term for this - Cargo Cult Programming. Or rather, you get code like this as a direct consequence of Cargo Cult Programming. Code which superficially appears to work gets committed; the inferior cardboard cutouts which obviously didn't work don't get committed.

  • Sudo (unregistered)

    I DESPISE variable names like myVar or similar... they're the comic sans of variable names.

  • (cs) in reply to Englebart
    Englebart:
    I think that most of the code I wrote pre-Y2K will be fine until 2080 when input like 010180 will of course be translated as 01/01/1980.

    Du-UH. The whole point of the Y2K exercise was to remove all code which even allowed the treatment of 2-digit years.

  • UK_Aspie (unregistered)

    I had a doctor's appointment on 29 Feb 2000 and the reception computer thought I was a day late because it thought it was 1 March. Not everyone tested their systems.

Leave a comment on “Annual Y2K”

Log In or post as a guest

Replying to comment #:

« Return to Article