mirror of
https://github.com/opnsense/src.git
synced 2026-02-20 00:11:07 -05:00
1) For %Z format, understand "UTC" name too.
2) Return NULL if timegm() fails, because it means we can convert what we have in GMT to local time needed.
This commit is contained in:
parent
513798cc9c
commit
420bc6cee4
1 changed files with 5 additions and 1 deletions
|
|
@ -552,7 +552,8 @@ label:
|
|||
strncpy(zonestr, buf, cp - buf);
|
||||
zonestr[cp - buf] = '\0';
|
||||
tzset();
|
||||
if (0 == strcmp(zonestr, "GMT")) {
|
||||
if (0 == strcmp(zonestr, "GMT") ||
|
||||
0 == strcmp(zonestr, "UTC")) {
|
||||
*GMTp = 1;
|
||||
} else if (0 == strcmp(zonestr, tzname[0])) {
|
||||
tm->tm_isdst = 0;
|
||||
|
|
@ -674,6 +675,9 @@ strptime_l(const char * __restrict buf, const char * __restrict fmt,
|
|||
ret = _strptime(buf, fmt, tm, &gmt, loc);
|
||||
if (ret && gmt) {
|
||||
time_t t = timegm(tm);
|
||||
|
||||
if (t == -1)
|
||||
return (NULL);
|
||||
localtime_r(&t, tm);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue