So I'm writing this code that reads a bunch of rows from the database and modifies a bunch of other rows in a different table. For testing, I'm adding the data using a little SQL script. The dates in the first table are supposed to match the dates in the second table, but I was getting a warning that they were mismatched (they may sometimes be off by a day or two in real life, but that wasn't part of the test) and the difference was -31536000000 milliseconds, at which point I stared at the screen and (quietly) said "what the fuck???"
So I broke out the calculator.
31536000000 / 1000 = 31536000
31536000 / 60 = 525,600
Normally, I would have done more division. But at this point I just sort of stared at the screen, heard music in my head, and said "how can it be off by a year?" And sure enough, I'd put 2002 in the SQL script where I should have put 2003. It's a good thing that there's a 3-day weekend coming up, because you can see how sharp I am lately.
Sadly, fixing the script did not cause the code to magically start working (although it did make the warning message go away). But another minor edit did make the code work (it turns out that if you want to read a number from the database, you probably shouldn't tell JDBC that it's a timestamp. Who knew?)
It occurs to me that my faithful readers must think I'm like the dumbest programmer ever and be thanking their lucky stars that they don't have to work with me. Most of the time, I'm actually not. It's just that the screw-ups are more amusing and easier to discuss without mentioning anything that resembles intellectual property (although we are looking into whether "read a bunch of rows and then modify some rows in the other table" can be patented).