diff --git a/man/remind.1.in b/man/remind.1.in index 792f17a6..a2376d8c 100644 --- a/man/remind.1.in +++ b/man/remind.1.in @@ -3044,6 +3044,11 @@ This variable can be set only to ":" or ".". It holds the character used to separate portions of a time when \fBRemind\fR prints a TIME or DATETIME value. .TP +.B $TimetIs64bit (read-only) +This variable returns 1 if the internal C \fBtime_t\fR type is at least +64 bits long. If it returns 0, then some astronomical functions such as +solstice and equinox calculations will fail after the year 2037. +.TP .B $UntimedFirst (read-only) Set to 1 if the \fB\-g\fR option is used with a fourth sort character of "d"; set to 0 otherwise. diff --git a/src/var.c b/src/var.c index 16ad8e52..7989cd58 100644 --- a/src/var.c +++ b/src/var.c @@ -269,6 +269,18 @@ static int trig_day_func(int do_set, Value *val) return OK; } +static int timet_is_64_func(int do_set, Value *val) +{ + UNUSED(do_set); + val->type = INT_TYPE; + if (sizeof(time_t) >= (64 / CHAR_BIT)) { + val->v.val = 1; + } else { + val->v.val = 0; + } + return OK; +} + static int trig_mon_func(int do_set, Value *val) { int y, m, d; @@ -938,6 +950,7 @@ static SysVar SysVarArr[] = { {"TerminalBackground", 0, SPECIAL_TYPE, terminal_bg_func, 0, 0 }, {"Thursday", 1, TRANS_TYPE, "Thursday", 0, 0 }, {"TimeSep", 1, SPECIAL_TYPE, time_sep_func, 0, 0 }, + {"TimetIs64bit", 0, SPECIAL_TYPE, timet_is_64_func, 0, 0 }, {"Tm", 0, SPECIAL_TYPE, trig_mon_func, 0, 0 }, {"Today", 1, TRANS_TYPE, "today", 0, 0 }, {"Tomorrow", 1, TRANS_TYPE, "tomorrow", 0, 0 }, diff --git a/tests/test-rem b/tests/test-rem index a1385eee..9ff54d18 100644 --- a/tests/test-rem +++ b/tests/test-rem @@ -59,7 +59,7 @@ chmod 000 include_dir/04cantread.rem TEST_GETENV="foo bar baz" ; export TEST_GETENV echo "Test 1" > ../tests/test.out echo "" >> ../tests/test.out -../src/remind -e -dxte ../tests/test.rem 16 feb 1991 12:13 >> ../tests/test.out 2>&1 +../src/remind -e -dxte ../tests/test.rem 16 feb 1991 12:13 2>&1 | grep -v 'TimetIs64bit' >> ../tests/test.out echo "" >> ../tests/test.out echo "Test 2" >> ../tests/test.out echo "" >> ../tests/test.out diff --git a/tests/test.cmp b/tests/test.cmp index aefea631..4f07e12d 100644 --- a/tests/test.cmp +++ b/tests/test.cmp @@ -1381,7 +1381,7 @@ trigeventstart() => 1991-02-13@16:00 set a135 trigeventduration() trigeventduration() => 72:00 set a136 stdout() -stdout() => "FILE" +stdout() => "PIPE" # These will issue errors REM Mon OMIT Mon SKIP MSG Never ever ever... @@ -2727,7 +2727,7 @@ a047 -1 a135 72:00 a097 -3 a048 "foo" -a136 "FILE" +a136 "PIPE" a098 0 a049 21 a099 -1 @@ -24286,6 +24286,7 @@ $Td $TerminalBackground $Thursday $TimeSep +$TimetIs64bit $Tm $Today $Tomorrow