[Bug 251918] strptime(): %b always returns month 0
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Thu Dec 17 11:47:34 UTC 2020
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=251918
Bug ID: 251918
Summary: strptime(): %b always returns month 0
Product: Base System
Version: 12.2-RELEASE
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: bin
Assignee: bugs at FreeBSD.org
Reporter: ian at chard.org
I noticed this when using 'date -f' to convert a date string:
$ date -j -f '%b %j %T %Y %Z' 'Mar 18 12:00:00 2021 GMT'
Mon Jan 18 12:00:00 GMT 2021
Passing this directly to strptime() gives the same results. If I do
struct tm t;
strptime("Mar 18 12:00:00 2021 GMT", "%b %j %T %Y %Z", &t);
then t.tm_mon is always 0.
If I use an invalid month then strptime() returns NULL, so it is recognising
the month names, just not actually setting the correct month number in the
struct tm.
Tried with a couple of locales (including 'C') with the same results.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list