This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.22-261-ge952e1d


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  e952e1dfeb2a603ebd74ac5478a1218061ba893b (commit)
       via  900f33e23eaa20c0587f5a191b632a606e7fba5d (commit)
      from  8a44513e9ccb271e368b4aa3c9493b94a45e039d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e952e1dfeb2a603ebd74ac5478a1218061ba893b

commit e952e1dfeb2a603ebd74ac5478a1218061ba893b
Author: Vincent Bernat <Vincent.Bernat@exoscale.ch>
Date:   Thu Sep 17 09:56:13 2015 +0200

    time: in strptime(), make %z accept [+-]HH:MM tz [BZ #17887]
    
    In ISO 8601, +03:30 is a valid time zone. Currently, strptime() only
    parses it as a 2-digit time zone an believes this is +03:00. This change
    makes it accept a single colon.

diff --git a/ChangeLog b/ChangeLog
index 97f0548..760e9bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2015-09-18  Vincent Bernat  <vincent@bernat.im>
 
+	[BZ #17887]
+	* time/strptime_l.c (__strptime_internal): Make %z accept
+	[+-]HH:MM time zones.
+
+2015-09-18  Vincent Bernat  <vincent@bernat.im>
+
 	[BZ #17886]
 	* time/strptime_l.c (__strptime_internal): Make %z accept Z as a
 	valid time zone.
diff --git a/NEWS b/NEWS
index d304f8c..6a69bdb 100644
--- a/NEWS
+++ b/NEWS
@@ -11,11 +11,11 @@ Version 2.23
 
   2542, 2543, 2558, 2898, 4404, 6803, 14341, 14912, 15384, 15786, 15918,
   16141, 16296, 16415, 16517, 16519, 16520, 16521, 16734, 16973, 16985,
-  17118, 17243, 17244, 17787, 17886, 17905, 18084, 18086, 18240, 18265,
-  18370, 18421, 18480, 18525, 18595, 18610, 18618, 18647, 18661, 18674,
-  18675, 18681, 18757, 18778, 18781, 18787, 18789, 18790, 18795, 18796,
-  18820, 18823, 18824, 18857, 18863, 18870, 18872, 18873, 18875, 18887,
-  18921, 18951, 18952, 18961, 18966, 18967, 18970, 18977.
+  17118, 17243, 17244, 17787, 17886, 17887, 17905, 18084, 18086, 18240,
+  18265, 18370, 18421, 18480, 18525, 18595, 18610, 18618, 18647, 18661,
+  18674, 18675, 18681, 18757, 18778, 18781, 18787, 18789, 18790, 18795,
+  18796, 18820, 18823, 18824, 18857, 18863, 18870, 18872, 18873, 18875,
+  18887, 18921, 18951, 18952, 18961, 18966, 18967, 18970, 18977.
 
 * The obsolete header <regexp.h> has been removed.  Programs that require
   this header must be updated to use <regex.h> instead.
diff --git a/time/strptime_l.c b/time/strptime_l.c
index 989edd6..c3ce50f 100644
--- a/time/strptime_l.c
+++ b/time/strptime_l.c
@@ -749,9 +749,11 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
 	    rp++;
 	  break;
 	case 'z':
-	  /* We recognize three formats: if two digits are given, these
-	     specify hours.  If fours digits are used, minutes are
-	     also specified.  'Z' is equivalent to +0000.  */
+	  /* We recognize four formats:
+	     1. Two digits specify hours.
+	     2. Four digits specify hours and minutes.
+	     3. Two digits, ':', and two digits specify hours and minutes.
+	     4. 'Z' is equivalent to +0000.  */
 	  {
 	    val = 0;
 	    while (ISSPACE (*rp))
@@ -770,6 +772,8 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
 	      {
 		val = val * 10 + *rp++ - '0';
 		++n;
+		if (*rp == ':' && n == 2 && isdigit (*(rp + 1)))
+		  ++rp;
 	      }
 	    if (n == 2)
 	      val *= 100;
diff --git a/time/tst-strptime2.c b/time/tst-strptime2.c
index 3d906de..7fe7350 100644
--- a/time/tst-strptime2.c
+++ b/time/tst-strptime2.c
@@ -35,7 +35,8 @@ static bool verbose;
    following fields:
      Sign field consisting of a '+' or '-' sign,
      Hours field in two decimal digits, and
-     optional Minutes field in two decimal digits.
+     optional Minutes field in two decimal digits. Optionally,
+     a ':' is used to seperate hours and minutes.
 
    This function may write test strings with minutes values outside
    the valid range 00-59.  These are invalid strings and useful for
@@ -56,7 +57,7 @@ static bool verbose;
    range of 00 to 59.  */
 
 static long int
-mkbuf (char *buf, bool neg, unsigned int hhmm, size_t ndigits)
+mkbuf (char *buf, bool neg, bool colon, unsigned int hhmm, size_t ndigits)
 {
   const int mm_max = 59;
   char sign = neg ? '-' : '+';
@@ -66,7 +67,10 @@ mkbuf (char *buf, bool neg, unsigned int hhmm, size_t ndigits)
   long int expect = LONG_MAX;
 
   i = sprintf (buf, "%s %c", dummy_string, sign);
-  snprintf (buf + i, ndigits + 1, "%04u", hhmm);
+  if (colon)
+    snprintf (buf + i, ndigits + 2, "%02u:%02u", hh, mm);
+  else
+    snprintf (buf + i, ndigits + 1, "%04u", hhmm);
 
   if (mm <= mm_max && (ndigits == 2 || ndigits == 4))
     {
@@ -177,11 +181,22 @@ do_test (void)
       {
 	/* Test both positive and negative signs.  */
 
-	expect = mkbuf (buf, false, hhmm, ndigits);
+	expect = mkbuf (buf, false, false, hhmm, ndigits);
 	result |= compare (buf, expect, nresult);
 
-	expect = mkbuf (buf, true, hhmm, ndigits);
+	expect = mkbuf (buf, true, false, hhmm, ndigits);
 	result |= compare (buf, expect, nresult);
+
+	/* Test with colon as well.  */
+
+	if (ndigits >= 3)
+	  {
+	    expect = mkbuf (buf, false, true, hhmm, ndigits);
+	    result |= compare (buf, expect, nresult);
+
+	    expect = mkbuf (buf, true, true, hhmm, ndigits);
+	    result |= compare (buf, expect, nresult);
+	  }
       }
 
   if (result > 0 || verbose)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=900f33e23eaa20c0587f5a191b632a606e7fba5d

commit 900f33e23eaa20c0587f5a191b632a606e7fba5d
Author: Vincent Bernat <Vincent.Bernat@exoscale.ch>
Date:   Thu Sep 17 09:55:04 2015 +0200

    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.

diff --git a/ChangeLog b/ChangeLog
index 5fe57ba..97f0548 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-09-18  Vincent Bernat  <vincent@bernat.im>
+
+	[BZ #17886]
+	* time/strptime_l.c (__strptime_internal): Make %z accept Z as a
+	valid time zone.
+
 2015-09-17  Mike Frysinger  <vapier@gentoo.org>
 
 	* sysdeps/unix/sysv/linux/alpha/Makefile (CFLAGS-fdatasync.c): Delete.
diff --git a/NEWS b/NEWS
index e5a4629..d304f8c 100644
--- a/NEWS
+++ b/NEWS
@@ -11,11 +11,11 @@ Version 2.23
 
   2542, 2543, 2558, 2898, 4404, 6803, 14341, 14912, 15384, 15786, 15918,
   16141, 16296, 16415, 16517, 16519, 16520, 16521, 16734, 16973, 16985,
-  17118, 17243, 17244, 17787, 17905, 18084, 18086, 18240, 18265, 18370,
-  18421, 18480, 18525, 18595, 18610, 18618, 18647, 18661, 18674, 18675,
-  18681, 18757, 18778, 18781, 18787, 18789, 18790, 18795, 18796, 18820,
-  18823, 18824, 18857, 18863, 18870, 18872, 18873, 18875, 18887, 18921,
-  18951, 18952, 18961, 18966, 18967, 18970, 18977
+  17118, 17243, 17244, 17787, 17886, 17905, 18084, 18086, 18240, 18265,
+  18370, 18421, 18480, 18525, 18595, 18610, 18618, 18647, 18661, 18674,
+  18675, 18681, 18757, 18778, 18781, 18787, 18789, 18790, 18795, 18796,
+  18820, 18823, 18824, 18857, 18863, 18870, 18872, 18873, 18875, 18887,
+  18921, 18951, 18952, 18961, 18966, 18967, 18970, 18977.
 
 * The obsolete header <regexp.h> has been removed.  Programs that require
   this header must be updated to use <regex.h> instead.
diff --git a/time/strptime_l.c b/time/strptime_l.c
index 4203ad8..989edd6 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++ == '-';
diff --git a/time/tst-strptime2.c b/time/tst-strptime2.c
index 5b06a63..3d906de 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),

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog            |   12 ++++++++++++
 NEWS                 |   10 +++++-----
 time/strptime_l.c    |   16 +++++++++++++---
 time/tst-strptime2.c |   35 +++++++++++++++++++++++++++++------
 4 files changed, 59 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]