Bug 117821 - y2038 bugs in gmtime, localtime
Summary: y2038 bugs in gmtime, localtime
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: rawhide
Hardware: i586
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2004-03-08 22:58 UTC by John G. Myers
Modified: 2007-11-30 22:10 UTC (History)
2 users (show)

Clone Of:
Last Closed: 2004-03-22 17:38:57 UTC

Attachments (Terms of Use)
Test case (447 bytes, text/plain)
2004-03-08 22:58 UTC, John G. Myers
no flags Details

Description John G. Myers 2004-03-08 22:58:15 UTC
Description of problem:

gmtime and localtime produce incorrect output for time values after
January 19, 2038 03:14:07 GMT.

Version-Release number of selected component (if applicable):


How reproducible:

Run the attached test program.

Steps to Reproduce:
Actual results:

time = 2038-01-19 03:14:07
time = 2038-01-18 19:14:07
time = 1901-12-13 20:45:52
time = 1901-12-13 12:45:52

Expected results:

time = 2038-01-19 03:14:07
time = 2038-01-18 19:14:07
time = 2038-01-19 03:14:08
time = 2038-01-18 19:14:08

Additional info:

Comment 1 John G. Myers 2004-03-08 22:58:55 UTC
Created attachment 98387 [details]
Test case

Comment 2 Jakub Jelinek 2004-03-09 13:59:59 UTC
This is a WONTFIX for 32-bit arches, sorry, but I don't think there
will be many 32-bit arches out there in 34 years from now.
[jakub@hammer obj]$ ./test
time = 2038-01-19 03:14:07
time = 2038-01-19 04:14:07
time = 2038-01-19 03:14:08
time = 2038-01-19 04:14:08
works just fine.  With the advent of AMD64 and IA32e I think most of
the computers out there will be 64-bit already within at most 5 years.
If 32-bit platforms are still around in big enough quantities in
2030, this can be certainly reconsidered, but until then it is just
a waste of time.

Comment 3 John G. Myers 2004-03-09 18:46:45 UTC
There are things, such as CA certificates, mortgage amoritizations,
etc. that need to deal with dates 35 or more years into the future.

I wouldn't have filed the bug if I hadn't encountered it.  It prevents
openssl from being able to create a cert with a liftime past 2038.

Comment 4 Jakub Jelinek 2004-03-22 17:38:57 UTC
Then openssl needs to use its own timekeeping, it is as simple as that.
gmtime/localtime is not an API to work with any time in the history/future.
It will not handle pre-1900 dates either and similarly to this, applications
which need to work with such dates need to handle it on their own.

Note You need to log in before you can comment on or make changes to this bug.