mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 06:48:47 +02:00
Make "tzconvert" warn about bad time zones.
This commit is contained in:
20
src/funcs.c
20
src/funcs.c
@@ -4320,6 +4320,7 @@ static int FTzconvert(func_info *info)
|
||||
{
|
||||
int year, month, day, hour, minute, r;
|
||||
int dse, tim;
|
||||
char const *src_tz, *tgt_tz;
|
||||
struct tm tm;
|
||||
|
||||
if (ARG(0).type != DATETIME_TYPE ||
|
||||
@@ -4333,11 +4334,26 @@ static int FTzconvert(func_info *info)
|
||||
minute = r % 60;
|
||||
|
||||
if (Nargs == 2) {
|
||||
src_tz = ARGSTR(1);
|
||||
warn_if_timezone_bad(src_tz);
|
||||
if (*src_tz == '!') {
|
||||
src_tz++;
|
||||
}
|
||||
r = tz_convert(year, month, day, hour, minute,
|
||||
ARGSTR(1), NULL, &tm);
|
||||
src_tz, NULL, &tm);
|
||||
} else {
|
||||
src_tz = ARGSTR(1);
|
||||
warn_if_timezone_bad(src_tz);
|
||||
if (*src_tz == '!') {
|
||||
src_tz++;
|
||||
}
|
||||
tgt_tz = ARGSTR(2);
|
||||
warn_if_timezone_bad(tgt_tz);
|
||||
if (*tgt_tz == '!') {
|
||||
tgt_tz++;
|
||||
}
|
||||
r = tz_convert(year, month, day, hour, minute,
|
||||
ARGSTR(1), ARGSTR(2), &tm);
|
||||
src_tz, tgt_tz, &tm);
|
||||
}
|
||||
|
||||
if (r == -1) return E_CANT_CONVERT_TZ;
|
||||
|
||||
Reference in New Issue
Block a user