[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
strptime() : porting to AIX problem
From: |
WHarms |
Subject: |
strptime() : porting to AIX problem |
Date: |
Wed, 31 Oct 2001 18:22:16 +0100 |
hi list,
While porting a glibc application to AIX i found a incompartibility in
strptime().
This was discussed recently on comp.sys.aix. I thing the results should be
noted in the info/man-pages because it may concern more systems than just AIX.
jon wrote a variation on my org. theme:
/*
from: address@hidden (Jon Parmet)
*/
#include <time.h>
#include <stdio.h>
main()
{
struct tm the_time;
char tt[20];
strcpy(tt,"23102001233300");
strptime(tt,"%d%m%Y%H%M%S",&the_time);
puts(asctime(&the_time));
}
the output produced is:
Sun Jan 0 00:00:80 1900
It works fine with glibc6, but the AIX guy have also there point:
/* again: jon@ */
FWIW, the Single-Unix specification for strptime says:
http://www.opengroup.org/onlinepubs/007908799/xsh/strptime.html
The format is composed of zero or more directives. Each
directive is composed of one of the following: one or more
white-space characters (as specified by isspace(); an ordinary
character (neither % nor a white-space character); or a
conversion specification. Each conversion specification is
composed of a % character followed by a conversion character
which specifies the replacement required. There must be
white-space or other non-alphanumeric characters between any
two conversion specifications. ...
I am pretty sure that different standards differ in these point but the
man-page should be clear and say something like ..
"in extension to the Single-Unix specification the glibc strptime() also
supports no white-spaces in format strings e.g.:
strptime(tt,"%d%m%Y%H%M%S",&the_time); "
btw: i prefer the glibc-version
hope that helps.
walter
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- strptime() : porting to AIX problem,
WHarms <=