diff options
author | Vincent Bernat <Vincent.Bernat@exoscale.ch> | 2015-09-17 09:55:04 +0200 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2015-09-18 01:15:45 -0400 |
commit | 900f33e23eaa20c0587f5a191b632a606e7fba5d (patch) | |
tree | bdca7d3576e31d47767fec3f5ae52673253a843d /time/strptime_l.c | |
parent | 8a44513e9ccb271e368b4aa3c9493b94a45e039d (diff) | |
download | glibc-900f33e23eaa20c0587f5a191b632a606e7fba5d.tar glibc-900f33e23eaa20c0587f5a191b632a606e7fba5d.tar.gz glibc-900f33e23eaa20c0587f5a191b632a606e7fba5d.tar.bz2 glibc-900f33e23eaa20c0587f5a191b632a606e7fba5d.zip |
time: in strptime(), make %z accept Z as a time zone [BZ #17886]
In ISO 8601, the timezone can be 'Z' instead of using
digits. 2014-08-17T12:33:12+0000 is often expressed as
2014-08-17T12:33:12Z.
Diffstat (limited to 'time/strptime_l.c')
-rw-r--r-- | time/strptime_l.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/time/strptime_l.c b/time/strptime_l.c index 4203ad81a0..989edd6144 100644 --- a/time/strptime_l.c +++ b/time/strptime_l.c @@ -749,13 +749,19 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM) rp++; break; case 'z': - /* We recognize two formats: if two digits are given, these + /* We recognize three formats: if two digits are given, these specify hours. If fours digits are used, minutes are - also specified. */ + also specified. 'Z' is equivalent to +0000. */ { val = 0; while (ISSPACE (*rp)) ++rp; + if (*rp == 'Z') + { + ++rp; + tm->tm_gmtoff = 0; + break; + } if (*rp != '+' && *rp != '-') return NULL; bool neg = *rp++ == '-'; |