Grant Update: y2038 fix

From a mail on Perl 5 Porters:

Attached is the latest 2038 patch from the y2038 branch.

  • Configure now probes for the safe range of the system's localtime() and gmtime(). Perl will use the system functions inside their safe range. Thanks Merijn
  • Perl now ships with its own 64 bit gmtime() and timegm().
  • localtime() is made 2038 safe on 32 bit systems using the algorithm described here
  • Time::Local can now handle past 2038.
  • Time::gmtime tests improved and expanded past 2038 and 1901.
  • Time::localtime tests improved and expanded past 2038.

Open issues

  • localtime64.h and .c need to be wired into the Makefile. I don't now how to do this.
  • The LOCALTIME_EDGECASE_BROKEN special case needs to be reincorporated.
  • This has not been tested on a system with an unsigned or floating point time_t.
  • The configure probes are probably broken with a floating point time_t.

Other notes

  • The clever way Time::Local handles the year (8, 108 and 2008 are all 2008) means there are gaps in what years you can run through timelocal() and timegm().
  • Since localtime64.c now has its own timegm() core time modules could make use of it.

I've hit the limit of what I can do alone. I'd like to see this incorporated into the bleadperl trunk so it can get some cross-platform testing.


Post a comment

If you have an OpenId URL, you can enter it here to post comments on this site.


This page contains a single entry from the blog posted on November 12, 2008.

Many more entries can be found on the main index page or by looking through the archives.

Powered by