From owner-freebsd-bugs Wed May 2 3: 0: 8 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 6EDE937B423 for ; Wed, 2 May 2001 03:00:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f42A02O12220; Wed, 2 May 2001 03:00:02 -0700 (PDT) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 1EA4437B422 for ; Wed, 2 May 2001 02:57:00 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f429v0e11951; Wed, 2 May 2001 02:57:00 -0700 (PDT) (envelope-from nobody) Message-Id: <200105020957.f429v0e11951@freefall.freebsd.org> Date: Wed, 2 May 2001 02:57:00 -0700 (PDT) From: thz@lennartz-electronic.de To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: bin/27029: strptime: %s formatting missing (patch) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 27029 >Category: bin >Synopsis: strptime: %s formatting missing (patch) >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed May 02 03:00:02 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Thomas Zenker >Release: 4.3-STABLE >Organization: Lennartz electronic >Environment: FreeBSD mezcal.tue.le 4.3-STABLE FreeBSD 4.3-STABLE #6: Wed May 2 08:50:01 CEST 2001 root@mezcal.tue.le:/usr/obj/usr/src/sys/MEZCAL i386 >Description: for date manipulations in ascii form is documented, that all formattings of date (resp. strftime) can be read by strptime. However, the "%s" format (seconds UTC since epoch) is not recognized. A patch, which integrates this format is supplied. >How-To-Repeat: date -j -f "%s" `date "+%s"` >Fix: Index: lib/libc/stdtime/strptime.c =================================================================== RCS file: /usr/cvs/FreeBSD/src/lib/libc/stdtime/strptime.c,v retrieving revision 1.17.2.1 diff -u -r1.17.2.1 strptime.c --- lib/libc/stdtime/strptime.c 2000/10/26 16:07:53 1.17.2.1 +++ lib/libc/stdtime/strptime.c 2001/04/27 19:38:51 @@ -513,6 +513,16 @@ } } break; + case 's': + { + time_t t; + const char *cp; + t = strtol(buf, &cp, 10); + buf = cp; + memcpy(tm, gmtime(&t), sizeof(struct tm)); + got_GMT = 1; + } + break; } } return (char *)buf; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message