changing time_t to an unsigned int would give another 68 years without any of the size/performance problems mentioned in Tom's email. joel ## From tomp@zk3.dec.com Tue Nov 11 12:40:27 1997 ## Old-Return-Path: <tomp@zk3.dec.com> ## To: tz@elsie.nci.nih.gov ## Cc: Tom Peterson <tomp@zk3.dec.com>, simons@zk3.dec.com, dlong@zk3.dec.com ## Subject: 32-bit 2038 issue ## X-Mts: smtp ## ## ## Has anyone considered what to do about time zone files and the 32-bit 2038 ## issue? This comment from zic.c sums up the problem: ## ## > /* ## > ** The tz file format currently allows at most 32-bit quantities. ## > ** This restriction should be removed before signed 32-bit values ## > ** wrap around in 2038, but unfortunately this will require a ## > ** change to the tz file format. ## > */ ## ## With Y2K bringing attention to time-related problems, there's an increasing ## awareness/concern about the 2038 issue as well. People know it's not just a ## system clock setting issue. The limitations affect projected dates used by ## applications as well. Problems are already cropping up where financial ## institutions can't generate amortization data for 40, 50, etc year loans and ## the like. I expect there are other practical examples as well. ## ## As new 64-bit UNIX platforms are emerging, there's a trend toward 64-bit ## time_t's. While this certainly eliminates the 2038 limit, it also creates a ## problem for time zone data files. A time zone file filled with data spanning ## 64-bits of seconds-based time would be huge, not to mention the performance ## problems of accessing it. Some ideas for addressing this problem are: ## ## 1) Expand the date/time boundaries for time zone files to a specific range. ## This would have to balance file size vs anticipated application needs. ## Perhaps an upper limit corresponding to the year 2100 or 2200 would suffice? ## Regardless of the range set, this approach only delays the problem. ## ## 2) Find some way to mimic what the zic compiler does at run-time. This might ## involve generating some kind of algorithmic data for each time zone which can ## be used to calculate future transition times, etc on-the-fly. I'm not sure ## this is possible or practical given the varied complexity of time zone rules. ## ## 3) Other ideas??? ## ## Also, with 64-bit time_t's, the tm struct becomes the limiting factor. ## Boundary checks now become an issue for localtime()/gmtime() instead of ## mktime(). This is a problem for standards at a mininum. While mktime() has ## the (somewhat ambiguous) -1 return value for non-representable times, no such ## provision is defined for localtime()/gmtime(). ## ## Any ideas or precedent for addressing this issue? ## ## thanks, ## - Tom ## ## ===================================================================== ## Tom Peterson | DIGITAL UNIX Development Environment ## Digital Equipment Corporation | Phone: (603) 884-7550 ## 110 Spit Brook Road ZKO3-2/W17 | FAX: (603) 884-2257 ## Nashua, NH 03062-2698 | Email: mailto:tomp@zk3.dec.com ## ## ##
Date: Tue, 11 Nov 1997 13:50:33 -0800 From: Joel.Tornatore@Eng.Sun.COM (Joel Tornatore) changing time_t to an unsigned int would give another 68 years But that would break backward compatibility with many applications. Few vendors have gone to an unsigned time_t (in fact, I don't know of any offhand) and there are good reasons for this. I can represent my date of birth as a signed time_t, but not as an unsigned time_t. Many apps depend on storing dates of birth and the like. (I know POSIX.1 doesn't guarantee that time_t is signed, but we're talking common practice here.) I don't think that changing time_t to a 64-bit quantity will hurt performance much. Few apps have arrays of a million time_t values. The biggest hassle of going to 64-bit time_t will be compatibility problems. I've heard that Solaris 2.7 will support LP64. Clearly Sun will have many compatibility problems in growing `long' from 32 to 64 bits. I expect that the most natural thing for Sun to do is to make time_t 64 bits in LP64 mode, as historically time_t was an alias for `long' and I still run into software that assumes this. This may cause some compatibility gotchas, but to some extent they're inevitable and at any rate they'll be in the noise compared to the overall hassle of going from ILP32 to LP64.
participants (2)
-
Joel.Tornatore@Eng.Sun.COM -
Paul Eggert