diff options
author | 2014-10-11 02:21:27 +0000 | |
---|---|---|
committer | 2014-10-11 02:21:27 +0000 | |
commit | 6ccc107ade747eaea4d60f5b4b4f659a53a18b3a (patch) | |
tree | 0118a931cfc16faa2bab59557164498753f394a7 /lib | |
parent | s/lenght/length/ in comments (diff) | |
download | wireguard-openbsd-6ccc107ade747eaea4d60f5b4b4f659a53a18b3a.tar.xz wireguard-openbsd-6ccc107ade747eaea4d60f5b4b4f659a53a18b3a.zip |
Add UTC support to %Z conversion in strptime().
Patch from jmates at ee dot washington dot edu.
ok otto@, millert@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/time/strptime.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/libc/time/strptime.c b/lib/libc/time/strptime.c index 68e3ecf3906..c36023e8c75 100644 --- a/lib/libc/time/strptime.c +++ b/lib/libc/time/strptime.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strptime.c,v 1.17 2014/10/02 23:50:11 doug Exp $ */ +/* $OpenBSD: strptime.c,v 1.18 2014/10/11 02:21:27 doug Exp $ */ /* $NetBSD: strptime.c,v 1.12 1998/01/20 21:39:40 mycroft Exp $ */ /*- @@ -56,9 +56,7 @@ #define FIELD_TM_YEAR (1 << 4) static char gmt[] = { "GMT" }; -#ifdef TM_ZONE static char utc[] = { "UTC" }; -#endif /* RFC-822/RFC-2822 */ static const char * const nast[5] = { "EST", "CST", "MST", "PST", "\0\0\0" @@ -409,6 +407,15 @@ literal: tm->TM_ZONE = gmt; #endif bp += 3; + } else if (strncmp((const char *)bp, utc, 3) == 0) { + tm->tm_isdst = 0; +#ifdef TM_GMTOFF + tm->TM_GMTOFF = 0; +#endif +#ifdef TM_ZONE + tm->TM_ZONE = utc; +#endif + bp += 3; } else { ep = _find_string(bp, &i, (const char * const *)tzname, |