Date: Thu, 19 Feb 2004 15:30:25 -0800 (PST) From: Stefan `Sec` Zehl <sec@42.org> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/63064: strptime fails on %z Message-ID: <200402192330.i1JNUPY4079626@freefall.freebsd.org>
index | next in thread | raw e-mail
The following reply was made to PR bin/63064; it has been noted by GNATS.
From: Stefan `Sec` Zehl <sec@42.org>
To: Makoto Matsushita <matusita@jp.FreeBSD.org>
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/63064: strptime fails on %z
Date: Fri, 20 Feb 2004 00:21:50 +0100
On Fri, Feb 20, 2004 at 03:21 +0900, Makoto Matsushita wrote:
> Since '%z' format is not defined in th standard, it would be ok that
> strptime(3) doesn't support '%z'. Of course, it would be even better
> that strptime(3) supports all format characters in strftime(3).
I see. What about this patch?
--- /usr/src/lib/libc/stdtime/strptime.c.org Tue Mar 12 18:24:54 2002
+++ /usr/src/lib/libc/stdtime/strptime.c Thu Feb 19 23:54:43 2004
@@ -492,6 +492,29 @@
ptr++;
break;
+ case 'z':
+ if(*buf==0 || (buf[0]!='+' && buf[0] != '-'))
+ break;
+
+ {
+ signed char sign;
+
+ sign = (buf++[0] == '-') ? -1 : +1;
+
+ len = 4;
+ for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
+ i *= 10;
+ i += *buf - '0';
+ len--;
+ }
+
+ tm->tm_hour-= sign*(i/100);
+ tm->tm_min-= sign*(i%100);
+ got_GMT=1;
+
+ }
+ break;
+
case 'Z':
{
const char *cp;
CU,
Sec
--
Cultures consist of people, and the traditional way to learn Unix culture is
from other people and through the folklore, by osmosis.
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200402192330.i1JNUPY4079626>
