As done in base e.g. usr.bin/cvs/date.y r1.23 Add an XXX comment for stupid static LeapYears table in trn/tin.
17 lines
811 B
Plaintext
17 lines
811 B
Plaintext
$OpenBSD: patch-lib_getdate_y,v 1.1 2013/04/19 21:32:37 sthen Exp $
|
|
--- lib/getdate.y.orig Fri Apr 19 21:26:06 2013
|
|
+++ lib/getdate.y Fri Apr 19 22:18:00 2013
|
|
@@ -651,9 +651,9 @@ Convert(time_t Month, time_t Day, time_t Year,
|
|
Year += 1900;
|
|
DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)
|
|
? 29 : 28;
|
|
- /* Checking for 2038 bogusly assumes that time_t is 32 bits. But
|
|
- I'm too lazy to try to check for time_t overflow in another way. */
|
|
- if (Year < EPOCH || Year > 2038
|
|
+ /* XXX Sloppily check for 2038 if time_t is 32 bits */
|
|
+ if (Year < EPOCH
|
|
+ || (sizeof(time_t) == sizeof(int) && Year > 2038)
|
|
|| Month < 1 || Month > 12
|
|
/* Lint fluff: "conversion from long may lose accuracy" */
|
|
|| Day < 1 || Day > DaysInMonth[(int)--Month])
|