From owner-svn-src-all@FreeBSD.ORG Thu Jun 25 23:59:24 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 210AC106566C; Thu, 25 Jun 2009 23:59:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F0DC8FC16; Thu, 25 Jun 2009 23:59:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PNxNlK068323; Thu, 25 Jun 2009 23:59:23 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PNxNHR068321; Thu, 25 Jun 2009 23:59:23 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906252359.n5PNxNHR068321@svn.freebsd.org> From: Xin LI Date: Thu, 25 Jun 2009 23:59:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195015 - head/lib/libc/stdtime X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 23:59:24 -0000 Author: delphij Date: Thu Jun 25 23:59:23 2009 New Revision: 195015 URL: http://svn.freebsd.org/changeset/base/195015 Log: Implement %z for strptime. PR: kern/63064 Submitted by: Stefan `Sec` Zehl (with some small changes) MFC after: 1 month Modified: head/lib/libc/stdtime/strptime.c Modified: head/lib/libc/stdtime/strptime.c ============================================================================== --- head/lib/libc/stdtime/strptime.c Thu Jun 25 23:22:25 2009 (r195014) +++ head/lib/libc/stdtime/strptime.c Thu Jun 25 23:59:23 2009 (r195015) @@ -514,6 +514,34 @@ label: } } break; + + case 'z': + { + int sign = 1; + + if (*buf != '+') { + if (*buf == '-') + sign = -1; + else + return 0; + } + + buf++; + i = 0; + for (len = 4; len > 0; len--) { + if (isdigit((int)*buf)) { + i *= 10; + i += *buf - '0'; + buf++; + } else + return 0; + } + + tm->tm_hour -= sign * (i / 100); + tm->tm_min -= sign * (i % 100); + *GMTp = 1; + } + break; } } return (char *)buf;