Date: Mon, 29 Sep 2003 10:56:01 -0700 From: Brian Dessent <brian@dessent.net> To: freebsd-bugs@FreeBSD.ORG Subject: strptime() in libc has a manpage error Message-ID: <3F787231.4F13AB6E@dessent.net>
next in thread | raw e-mail | index | archive | help
Apologies for not using send-pr, however the freebsd.org mailserver will not accept mail from the freebsd system that I have access to, because it does not have a reverse DNS entry. That aspect of DNS is out of my control (and I've asked) so that leaves me with no way to use 'send-pr'. I really wish your mailserver weren't so restrictive. Anyway... The manpage for strptime(3) claims that "all conversion specifications are identical to those described in strftime(3)". strftime(3) claims to support "%z", as follows: ----- %z is replaced by the time zone offset from UTC; a leading plus sign stands for east of UTC, a minus sign for west of UTC, hours and minutes follow with two digits each and no delimiter between them (common form for RFC 822 date headers). ----- However, the code for strptime() contains no such conversion specifier, and this manpage entry is just wrong. You can easily verify this by looking at the code for strptime: <http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/stdtime/strptime.c?rev=1.34&content-type=text/x-cvsweb-markup> which clearly has no provision to handle the "%z" case. This can be demonstrated with the following perl command (which calls the libc strptime() directly): ----- $ perl -MTime::Piece -e \ '$ts = Time::Piece->strptime("29/Sep/2003:17:19:55 -0700", "%d/%b/%Y:%H:%M:%S %z"); print $ts->cdate;' garbage at end of string in strptime: -0700 at /usr/local/lib/perl5/site_perl/5.6.1/mach/Time/Piece.pm line 442. Mon Sep 29 17:19:55 2003 ----- FreeBSD RELENG_4_8 i386, yadda yadda yadda Lets just say that this has resulted in much hair pulling and cursing at perl, only to discover that the FBSD manpage is flat out wrong. Brian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F787231.4F13AB6E>