Handle another time zone edge case.

This commit is contained in:
Dianne Skoll
2025-09-03 13:21:16 -04:00
parent 5f9e71f9eb
commit bcfee04cae
2 changed files with 9 additions and 6 deletions

View File

@@ -135,11 +135,15 @@ void EnterTimezone(char const *tz)
/* Update our variables */
(void) localtime_r(&t, &tm);
SysTime = tm.tm_min * 60 + (tm.tm_hour * 3600);
CurDay = tm.tm_mday;
CurMon = tm.tm_mon;
CurYear = tm.tm_year + 1900;
DSEToday = DSE(CurYear, CurMon, CurDay);
SysTime = tm.tm_min * 60 + (tm.tm_hour * 3600);
/* Adjust DSEToday back by a day if midnight in our time zone requires it */
if (SysTime < LocalSysTime) {
DSEToday--;
FromDSE(DSEToday, &CurYear, &CurMon, &CurDay);
}
if (DebugFlag & DB_SWITCH_ZONE) {
fprintf(stderr, "TZ enter %s: %04d-%02d-%02d %02d:%02d\n", tz,
@@ -1089,7 +1093,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
return E_TZ_SPECIFIED_TWICE;
}
r = ParseQuotedString(s, &buf);
r = ParseTokenOrQuotedString(s, &buf);
if (r != OK) {
return r;
}

View File

@@ -4297,14 +4297,13 @@ FMultiTrig(func_info *info)
Eprint(tr("Cannot use AT clause in multitrig() function"));
return E_PARSE_ERR;
}
EnterTimezone(trig.tz);
dse = ComputeTrigger(get_scanfrom(&trig), &trig, &tim, &r, 0);
ExitTimezone(trig.tz);
/* multitrig only does untimed reminders, so no need to worry
about time zones */
DestroyParser(&p);
if (r != E_CANT_TRIG) {
dse = AdjustTriggerForTimeZone(&trig, dse, &tim);
if (dse < earliest || earliest < 0) {
earliest = dse;
}