@@ -24,7 +24,7 @@ time_t tm_to_time_t(const struct tm *tm)
2424 int month = tm -> tm_mon ;
2525 int day = tm -> tm_mday ;
2626
27- if (year < 0 || year > 129 ) /* algo only works for 1970-2099 */
27+ if (year < 0 ) /* algo only works for 1970+ */
2828 return -1 ;
2929 if (month < 0 || month > 11 ) /* array bounds */
3030 return -1 ;
@@ -33,6 +33,7 @@ time_t tm_to_time_t(const struct tm *tm)
3333 if (tm -> tm_hour < 0 || tm -> tm_min < 0 || tm -> tm_sec < 0 )
3434 return -1 ;
3535 return (year * 365 + (year + 1 ) / 4 + mdays [month ] + day ) * 24 * 60 * 60UL +
36+ (year + 369 ) / 400 - (year + 69 ) / 100 +
3637 tm -> tm_hour * 60 * 60 + tm -> tm_min * 60 + tm -> tm_sec ;
3738}
3839
@@ -526,7 +527,7 @@ static int set_date(int year, int month, int day, struct tm *now_tm, time_t now,
526527 return 1 ;
527528 r -> tm_year = now_tm -> tm_year ;
528529 }
529- else if (year >= 1970 && year < 2100 )
530+ else if (year >= 1970 )
530531 r -> tm_year = year - 1900 ;
531532 else if (year > 70 && year < 100 )
532533 r -> tm_year = year ;
@@ -871,8 +872,8 @@ static int match_object_header_date(const char *date, timestamp_t *timestamp, in
871872}
872873
873874
874- /* timestamp of 2099-12-31T23:59:59Z, including 32 leap days */
875- static const timestamp_t timestamp_max = ((( timestamp_t ) 2100 - 1970 ) * 365 + 32 ) * 24 * 60 * 60 - 1 ;
875+ /* timestamp of max time */
876+ static const timestamp_t timestamp_max = UINTMAX_MAX ;
876877
877878/* Gr. strptime is crap for this; it doesn't have a way to require RFC2822
878879 (i.e. English) day/month names, and it doesn't work correctly with %z. */
0 commit comments