From 691d6b33ee7454f9559239b86387bb5673274bec Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Sun, 19 Nov 2017 22:51:57 +0100 Subject: Check for the year span 1902-2037 Reintroduce year check for systems with a 32-bit time_t type. Remove the lower limit (1902) for systems with a 64-bit time_t. This limits movements in the calendar (for 32-bit systems) and in no way ensures constistency of data. Commit a12833e (Handle dates past January 19th, 2038, 2015-01-19) removed the upper limit (2037) on dates but left the lower limit (1902). It did not ensure the support of the target system. Signed-off-by: Lukas Fleischer --- src/calcurse.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/calcurse.h') diff --git a/src/calcurse.h b/src/calcurse.h index ca55e1f..f4f0e6c 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -304,10 +304,15 @@ enum datefmt { /* Day heading default format. */ #define DAY_HEADING_DEFAULT "%B %-d, %Y" +/* + * Calcurse representation of the date of a day in the calendar. + * When time_t is a 32-bit signed integer, the year range is 1902 - 2037. + */ +#define YEAR1902_2037 (sizeof(time_t) == 4) struct date { - unsigned dd; - unsigned mm; - unsigned yyyy; + unsigned dd; /* day: 1 - 31 */ + unsigned mm; /* month: 1 - 12 */ + unsigned yyyy; /* year AD */ }; #define ISLEAP(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0) -- cgit v1.2.3-54-g00ecf