[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
library/2215: strptime() problems
- To: gnats@openbsd.org
- Subject: library/2215: strptime() problems
- From: nickus@mpi-cbg.de
- Date: Thu, 29 Nov 2001 00:01:37 +0100 (MET)
- Resent-Date: Wed, 28 Nov 2001 16:10:02 -0700 (MST)
- Resent-From: gnats@cvs.openbsd.org (GNATS Management)
- Resent-Message-Id: <200111282310.fASNA2pa026362@cvs.openbsd.org>
- Resent-Reply-To: gnats@cvs.openbsd.org, nickus@mpi-cbg.de
- Resent-To: bugs@cvs.openbsd.org
>Number: 2215
>Category: library
>Synopsis: strptime() problems
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bugs
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Nov 28 16:10:01 MST 2001
>Last-Modified:
>Originator: Niclas Sodergard
>Organization:
net
>Release: 2.9
>Environment:
System : OpenBSD 2.9
Architecture: OpenBSD.i386
Machine : i386
>Description:
strptime() can't handle the string %Y%m%d%H%M%S even though
the input string is correct. I included a small C program
which shows the problem.
Can't really upgrade the machine to 3.0 so I don't know if
the bug is still there but I checked the CVS and the code
hadn't been changed for a while.
>How-To-Repeat:
#include <time.h>
#include <stdio.h>
int main(void)
{
time_t mytime;
char timebuf[32];
struct tm convtime;
mytime = time(NULL);
if(strftime(timebuf, 32, "%Y%m%d%H%M%S", gmtime(&mytime))) {
puts(timebuf);
if(strptime(timebuf, "%Y%m%d%H%M%S", &convtime))
puts("Worked");
else
puts("strptime failed");
} else
puts("Couldn't convert time");
}
>Fix:
>Audit-Trail:
>Unformatted: