This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1a][BZ #14876] Make strptime %Z consistent between doc and code.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 16 Oct 2013 19:34:25 +0200
- Subject: Re: [PATCH 1a][BZ #14876] Make strptime %Z consistent between doc and code.
- Authentication-results: sourceware.org; auth=none
- References: <20131016161110 dot GA16769 at domone dot podge> <877gdduqfj dot fsf at igel dot home>
On Wed, Oct 16, 2013 at 06:32:48PM +0200, Andreas Schwab wrote:
> OndÅej BÃlka <neleai@seznam.cz> writes:
>
> > diff --git a/time/strptime_l.c b/time/strptime_l.c
> > index 00fc1ef..0b901c1 100644
> > --- a/time/strptime_l.c
> > +++ b/time/strptime_l.c
> > @@ -744,8 +744,12 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
> > s.want_xday = 1;
> > break;
> > case 'Z':
> > - /* XXX How to handle this? */
> > - break;
> > + /* Read timezone but perform no conversion. */
> > + while (ISSPACE (*rp))
> > + rp++;
> > + while (!ISSPACE (*rp) && (*rp != '\0'))
>
> Please remove the extra parens.
>
OK now?
[BZ #14876]
* time/strptime_l.c: Read timezone entry.
diff --git a/time/strptime_l.c b/time/strptime_l.c
index 00fc1ef..0b901c1 100644
--- a/time/strptime_l.c
+++ b/time/strptime_l.c
@@ -744,8 +744,12 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
s.want_xday = 1;
break;
case 'Z':
- /* XXX How to handle this? */
- break;
+ /* Read timezone but perform no conversion. */
+ while (ISSPACE (*rp))
+ rp++;
+ while (!ISSPACE (*rp) && *rp != '\0')
+ rp++;
+ break;
case 'z':
/* We recognize two formats: if two digits are given, these
specify hours. If fours digits are used, minutes are
diff --git a/time/tst-strptime.c b/time/tst-strptime.c
index 21fbb63..193f7db 100644
--- a/time/tst-strptime.c
+++ b/time/tst-strptime.c
@@ -41,6 +41,7 @@ static const struct
{ "C", "19990502123412", "%Y%m%d%H%M%S", 0, 121, 4, 2 },
{ "C", "2001 20 Mon", "%Y %U %a", 1, 140, 4, 21 },
{ "C", "2001 21 Mon", "%Y %W %a", 1, 140, 4, 21 },
+ { "C", "2001 EST 21 Mon", "%Y %Z %W %a", 1, 140, 4, 21 },
{ "C", "2012 00 Sun", "%Y %W %a", 0, 0, 0, 1 },
{ "ja_JP.EUC-JP", "2000-01-01 08:12:21 AM", "%Y-%m-%d %I:%M:%S %p",
6, 0, 0, 1 },