This is the mail archive of the
mailing list for the glibc project.
[Bug libc/812] mktime does not return -1
- From: "uttamp at us dot ibm dot com" <sourceware-bugzilla at sources dot redhat dot com>
- To: glibc-bugs at sources dot redhat dot com
- Date: 11 Apr 2005 17:39:45 -0000
- Subject: [Bug libc/812] mktime does not return -1
- References: <firstname.lastname@example.org>
- Reply-to: sourceware-bugzilla at sources dot redhat dot com
------- Additional Comments From uttamp at us dot ibm dot com 2005-04-11 17:39 -------
(In reply to comment #5)
> It looks like mktime() will return INT_MIN if the value would be less than
> time_t's minimum, but not by more than 20 years, and it will return INT_MAX if
> the value would be greater than time_t's maximum, but not by more than 20 years.
> If the value exceeds time_t's range by more than 20 years, then mktime() will
> return -1. It should, however, return -1 in all three cases.
I think it should return -1 for the 2 cases you mentioned (if the value is less
than time_t's minimum or greter than time_t's maximum because if the value is
smaller or greater than those two threshold then it's going to wrap around to
give you wrong results). This is due to the size of time_t. On a 64-bit system
where size of size of time_t is 8 byes, this will hold valid seconds for many
years past and future of since epoch.
But for now it can represent only seconds for (tm_year) 138 years (since 1901
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.