Date: Thu, 11 Nov 1999 01:20:02 -0800 (PST) From: Sheldon Hearn <sheldonh@uunet.co.za> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/14817: strptime(3) '%C' conversion incorrect Message-ID: <199911110920.BAA97458@freefall.freebsd.org>
index | next in thread | raw e-mail
The following reply was made to PR bin/14817; it has been noted by GNATS.
From: Sheldon Hearn <sheldonh@uunet.co.za>
To: cjc@cc942873-a.ewndsr1.nj.home.com
Cc: FreeBSD-gnats-submit@FreeBSD.ORG, kevin.ruddy@powerdog.com
Subject: Re: bin/14817: strptime(3) '%C' conversion incorrect
Date: Thu, 11 Nov 1999 11:19:27 +0200
On Thu, 11 Nov 1999 00:43:29 EST, "Crist J. Clark" wrote:
> However, the '%C' conversion does not work as described in strftime(3)
> (which strptime(3) references as containing the key for the
> conversions), nor does a simple 'date +%C' return what the actual
> strptime(3) function wants.
I think that strptime(3) does behave as expected. I think you're
assuming too much.
> struct tm tm;
>
> strptime("19","%C",&tm);
>
> printf("%d\n",tm.tm_year);
You can't expect tm_year to contain anything sensible after your call to
strptime, because you haven't given it enough information. Try using it
in conjunction with %g and you'll get sensible results.
Ciao,
Sheldon.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911110920.BAA97458>
