diff options
author | mtm <mtm@FreeBSD.org> | 2003-03-29 11:55:37 +0000 |
---|---|---|
committer | mtm <mtm@FreeBSD.org> | 2003-03-29 11:55:37 +0000 |
commit | 41c45e390c4a55757151f30cc984b910d5239ba9 (patch) | |
tree | 4b93a1ab5be509f671cd25e0ad5abce89be0b6f9 /lib | |
parent | aca28d10d8a25c7bebb7aafbd6624f0b568fabb7 (diff) | |
download | FreeBSD-src-41c45e390c4a55757151f30cc984b910d5239ba9.zip FreeBSD-src-41c45e390c4a55757151f30cc984b910d5239ba9.tar.gz |
Fill in the rest of the fields in the resulting struct tm
from strptime(3). Previously, they would get filled only
for the %s specifier and as a side effect of using the
the %Z specifier with a GMT time zone.
PR: misc/48993
Approved by: markm (mentor)
Silence on: -standards
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/stdtime/strptime.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/stdtime/strptime.c b/lib/libc/stdtime/strptime.c index f69847a..21a47f7 100644 --- a/lib/libc/stdtime/strptime.c +++ b/lib/libc/stdtime/strptime.c @@ -518,12 +518,13 @@ strptime(const char * __restrict buf, const char * __restrict fmt, struct tm * __restrict tm) { char *ret; + time_t t; int gmt; gmt = 0; ret = _strptime(buf, fmt, tm, &gmt); - if (ret && gmt) { - time_t t = timegm(tm); + if (ret) { + t = gmt ? timegm(tm) : mktime(tm); localtime_r(&t, tm); } |