summaryrefslogtreecommitdiff
path: root/src/util/support/gmt_mktime.c
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2018-04-03 19:36:00 +0000
committerCy Schubert <cy@FreeBSD.org>2018-04-03 19:36:00 +0000
commitb0e4d68d5124581ae353493d69bea352de4cff8a (patch)
tree43300ec43e83eccd367fd76fdfdefba2dcd7d8f4 /src/util/support/gmt_mktime.c
parent33a9b234e7087f573ef08cd7318c6497ba08b439 (diff)
Notes
Diffstat (limited to 'src/util/support/gmt_mktime.c')
-rw-r--r--src/util/support/gmt_mktime.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/util/support/gmt_mktime.c b/src/util/support/gmt_mktime.c
index 32fef4386cd46..ac7752fefed0d 100644
--- a/src/util/support/gmt_mktime.c
+++ b/src/util/support/gmt_mktime.c
@@ -78,21 +78,20 @@ static const int days_in_month[12] = {
static time_t
gmt_mktime(struct tm *t)
{
- time_t accum;
+ uint32_t accum;
#define assert_time(cnd) if(!(cnd)) return (time_t) -1
/*
- * For 32-bit signed time_t centered on 1/1/1970, the range is:
- * time 0x80000000 -> Fri Dec 13 16:45:52 1901
- * time 0x7fffffff -> Mon Jan 18 22:14:07 2038
+ * For 32-bit unsigned time values starting on 1/1/1970, the range is:
+ * time 0x00000000 -> Thu Jan 1 00:00:00 1970
+ * time 0xffffffff -> Sun Feb 7 06:28:15 2106
*
- * So years 1901 and 2038 are allowable, but we can't encode all
- * dates in those years, and we're not doing overflow/underflow
- * checking for such cases.
+ * We can't encode all dates in 2106, and we're not doing overflow checking
+ * for such cases.
*/
- assert_time(t->tm_year>=1);
- assert_time(t->tm_year<=138);
+ assert_time(t->tm_year>=70);
+ assert_time(t->tm_year<=206);
assert_time(t->tm_mon>=0);
assert_time(t->tm_mon<=11);