Add $TimetIs64bit system variable.

This commit is contained in:
Dianne Skoll
2025-05-06 12:14:18 -04:00
parent 4515291720
commit 59f978a9db
4 changed files with 22 additions and 3 deletions

View File

@@ -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.

View File

@@ -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 },

View File

@@ -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

View File

@@ -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