about summary refs log tree commit diff
path: root/time/tst-strptime2.c
diff options
context:
space:
mode:
authorVincent Bernat <Vincent.Bernat@exoscale.ch>2015-09-17 09:55:04 +0200
committerMike Frysinger <vapier@gentoo.org>2015-09-18 01:15:45 -0400
commit900f33e23eaa20c0587f5a191b632a606e7fba5d (patch)
treebdca7d3576e31d47767fec3f5ae52673253a843d /time/tst-strptime2.c
parent8a44513e9ccb271e368b4aa3c9493b94a45e039d (diff)
downloadglibc-900f33e23eaa20c0587f5a191b632a606e7fba5d.tar.gz
glibc-900f33e23eaa20c0587f5a191b632a606e7fba5d.tar.xz
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/tst-strptime2.c')
-rw-r--r--time/tst-strptime2.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/time/tst-strptime2.c b/time/tst-strptime2.c
index 5b06a63ba4..3d906dec74 100644
--- a/time/tst-strptime2.c
+++ b/time/tst-strptime2.c
@@ -31,7 +31,8 @@ static bool verbose;
      whitespace matching strptime " " format specifier, and
      timezone string matching strptime "%z" format specifier.
 
-   Note that a valid timezone string contains the following fields:
+   Note that a valid timezone string is either "Z" or contains the
+   following fields:
      Sign field consisting of a '+' or '-' sign,
      Hours field in two decimal digits, and
      optional Minutes field in two decimal digits.
@@ -155,6 +156,13 @@ do_test (void)
   expect = LONG_MAX;
   result |= compare (buf, expect, nresult);
 
+  /* Create and test input string with "Z" input (valid format).
+     Expect tm_gmtoff of 0.  */
+
+  sprintf (buf, "%s Z", dummy_string);
+  expect = 0;
+  result |= compare (buf, expect, nresult);
+
   /* Create and test input strings with sign and digits:
      0 digits (invalid format),
      1 digit (invalid format),