preserve a copy of the tm so we can check later.

This commit is contained in:
christos 2015-12-08 12:51:04 +00:00
parent 8861b14877
commit 5fd02f85b5

View File

@ -14,7 +14,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifdef __RCSID #ifdef __RCSID
__RCSID("$NetBSD: parsedate.y,v 1.23 2015/12/07 20:55:49 christos Exp $"); __RCSID("$NetBSD: parsedate.y,v 1.24 2015/12/08 12:51:04 christos Exp $");
#endif #endif
#include <stdio.h> #include <stdio.h>
@ -675,10 +675,12 @@ Convert(
case DSToff: tm.tm_isdst = 0; break; case DSToff: tm.tm_isdst = 0; break;
default: tm.tm_isdst = -1; break; default: tm.tm_isdst = -1; break;
} }
otm = tm;
result = mktime(&tm); result = mktime(&tm);
} else { } else {
/* We rely on mktime_z(NULL, ...) working in UTC */ /* We rely on mktime_z(NULL, ...) working in UTC */
tm.tm_isdst = 0; /* hence cannot be summer time */ tm.tm_isdst = 0; /* hence cannot be summer time */
otm = tm;
errno = 0; errno = 0;
result = mktime_z(NULL, &tm); result = mktime_z(NULL, &tm);
if (result != -1 || errno == 0) { if (result != -1 || errno == 0) {