NetBSD Problem Report #6243
Received: (qmail 29509 invoked from network); 4 Oct 1998 19:26:28 -0000
Message-Id: <199810041920.VAA14767@petium.gmd.de>
Date: Sun, 4 Oct 1998 21:20:26 +0200 (CEST)
From: Peter Simons <simons@petium.gmd.de>
Reply-To: simons@petium.gmd.de
To: gnats-bugs@gnats.netbsd.org
Subject: strptime(3) produces wrong results
X-Send-Pr-Version: 3.95
>Number: 6243
>Category: lib
>Synopsis: strptime(3) produces wrong results
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: lib-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Oct 04 12:35:00 +0000 1998
>Closed-Date: Sun Oct 04 19:44:56 +0000 1998
>Last-Modified: Sun Oct 04 19:49:22 +0000 1998
>Originator: Peter Simons
>Release: NetBSD/i386 1.3
>Organization:
>Environment:
System: NetBSD petium.gmd.de 1.3 NetBSD 1.3 (PETIUM) #5: Tue Mar 24 18:00:04 CET 1998 simons@petium.rhein.de:/usr/src/sys/arch/i386/compile/PETIUM i386
>Description:
strptime() produces incorrect data when creating the tm
structure. If strptime() parses the month to be '10'
(October), it writes the '10' into the tm structure. The
tm_mon field in the tm structure, though, starts at zero!
Hence the result is one month in the future.
>How-To-Repeat:
#include <stdio.h>
#include <time.h>
int
main()
{
char buf[] = "10-04-1998";
struct tm tmp;
memset(&tmp, 0, sizeof(struct tm));
strptime(buf, "%m-%d-%Y", &tmp);
printf("%s", asctime(&tmp));
return 0;
}
| simons@petium:/tmp$ gcc test.c -o test && ./test
| Sun Nov 4 00:00:00 1998
>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: kleink
State-Changed-When: Sun Oct 4 12:44:56 PDT 1998
State-Changed-Why:
This has already been fixed in NetBSD 1.3.2, which you should upgrade your
system to.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.