This is the mail archive of the libc-alpha@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]

Re: [PATCH 2/2] time: in strptime(), make %z accept [+-]HH:MM tz [BZ #17887]


On 16 Sep 2015 10:47, Vincent Bernat wrote:
> --- a/time/strptime_l.c
> +++ b/time/strptime_l.c
>
> +		if (*rp == ':' && n == 2 && isdigit(*(rp + 1)))

needs a space: isdigit (...)

> --- a/time/tst-strptime2.c
> +++ b/time/tst-strptime2.c
>
> -  snprintf (buf + i, ndigits + 1, "%04u", hhmm);
> +  snprintf (buf + i,
> +	    (colon && ndigits >= 2) ? ndigits + 2 : ndigits + 1,
> +	    "%02u%s%02u", hh, colon ? ":" : "", mm);

i think the inlining of |colon| makes it hard to read.  just use an if
statement to do it:
  if (colon)
    snprintf (buf + i, ndigits + 2, "%02u:%02u", hh, mm);
  else
    snprintf (buf + i, ndigits + 1, "%04u", hhmm);
-mike

Attachment: signature.asc
Description: Digital signature


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