aboutsummaryrefslogtreecommitdiffstats
path: root/src/calcurse.h
diff options
context:
space:
mode:
authorLars Henriksen <LarsHenriksen@get2net.dk>2017-11-19 22:51:57 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2017-11-23 08:56:38 +0100
commit691d6b33ee7454f9559239b86387bb5673274bec (patch)
tree419631c296cc4a5dba2e385611fb40713e285e7f /src/calcurse.h
parent97c3e7f95726533897c3e65a09ffd2cd02d7e187 (diff)
downloadcalcurse-691d6b33ee7454f9559239b86387bb5673274bec.tar.gz
calcurse-691d6b33ee7454f9559239b86387bb5673274bec.zip
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 <lfleischer@calcurse.org>
Diffstat (limited to 'src/calcurse.h')
-rw-r--r--src/calcurse.h11
1 files changed, 8 insertions, 3 deletions
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)