Monday, January 28, 2008

Year 2038 Bug

I was working at Sun Microsystems when the whole Y2K scare approached like an impending apocalypse. When the lights didn't go out as the big ball dropped, it was quickly forgotten. The real boogy man amongst UNIX programmers was the Y2038 bug. That is when UNIX time, a 32 bit number representing the number of seconds since Jan 1, 1970, would wrap back to zero.

At the time I took solace in knowing I would have long since retired from programming by 2038. No worries.

I was wrong, so wrong.

Fast forward to Jan 19, 2008. logins stop working while I'm on a two week vacation in Costa Rica. I am blissfully ignorant of any problem and don't learn about it until I'm home again plowing though my unread emails. As it happens I was setting the login cookies to expire in 30 years, no need to annoy users with constant logins (are you listening Yahoo!?). However as of Jan 19, Perl's CGI::Cookies module thinks that +30 years is 1901. All of's cookies being expired by the browser, and all logins fail. Epoch fail. Sigh.

Two hours of debugging and two characters changed in my code, I won't have this problem again for another 25 years. By then I'll be retired. (insert sounds of knocking on wood)