Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

schwern (1528)

schwern
  (email not shown publicly)
http://schwern.net/
AOL IM: MichaelSchwern (Add Buddy, Send Message)
Jabber: schwern@gmail.com

Schwern can destroy CPAN at his whim.

Journal of schwern (1528)

Thursday October 02, 2008
12:24 AM

The Y3001 bug.

[ #37586 ]

In my attempts to make Perl's date handling as portable and future-proof as possible, I've tested a lot of implementations of gmtime() and localtime() on a lot of compilers and operating systems. This one takes the cake.

Microsoft Visual C++ 2008 Express Edition.
gmtime max    32535291599 (Thu Jan 01 20:59:59 3001)
localtime max 32535244799 (Thu Jan 01 07:59:59 3001)
gmtime min    -43200      (Thu Dec 31 12:00:00 1969)
localtime min 0           (Thu Jan 01 00:00:00 1970)

What?! 3001? What in the screaming hell is so special about Jan 1st, 3001? And what's up with failing at noon? And 3 hours, 1 second before midnight? Windows keeps its system clock in local time, but I'm in EDT (-4) so that doesn't jive.

Weird.

UPDATE: Turns out their difftime() can't handle negative times. WHAT?! It's a fucking SUBTRACTION FUNCTION!

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.