From owner-freebsd-bugs@FreeBSD.ORG Thu Feb 19 15:30:25 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D482C16A4CE for ; Thu, 19 Feb 2004 15:30:25 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D164443D2D for ; Thu, 19 Feb 2004 15:30:25 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i1JNUPbv079627 for ; Thu, 19 Feb 2004 15:30:25 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i1JNUPY4079626; Thu, 19 Feb 2004 15:30:25 -0800 (PST) (envelope-from gnats) Date: Thu, 19 Feb 2004 15:30:25 -0800 (PST) Message-Id: <200402192330.i1JNUPY4079626@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Stefan `Sec` Zehl Subject: Re: bin/63064: strptime fails on %z X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Stefan `Sec` Zehl List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2004 23:30:25 -0000 The following reply was made to PR bin/63064; it has been noted by GNATS. From: Stefan `Sec` Zehl To: Makoto Matsushita 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.