[Bug 137307] [libc] [patch] Enhance strptime(3) to support %U and %W
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Tue Jul 22 21:53:44 UTC 2014
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=137307
--- Comment #2 from Pedro F. Giffuni <pfg at FreeBSD.org> ---
(In reply to Pedro F. Giffuni from comment #1)
...
> I haven't tested it yet but I will.
>
Running test from:
http://www.scs.stanford.edu/histar/src/pkg/uclibc/test/time/tst-strptime.c
Results before the patch:
...
strptime ("2001 20 Mon", "%Y %U %a", ...)
should be: wday = 1, yday = 140, mon = 4, mday = 21
is: wday = 1, yday = 0, mon = 0, mday = 0
yearday for `2001 20 Mon' incorrect: 0 instead of 140
month for `2001 20 Mon' incorrect: 0 instead of 4
monthday for `2001 20 Mon' incorrect: 0 instead of 21
strptime ("2001 21 Mon", "%Y %W %a", ...)
should be: wday = 1, yday = 140, mon = 4, mday = 21
is: wday = 1, yday = 0, mon = 0, mday = 0
yearday for `2001 21 Mon' incorrect: 0 instead of 140
month for `2001 21 Mon' incorrect: 0 instead of 4
monthday for `2001 21 Mon' incorrect: 0 instead of 21
Results after the patch:
...
strptime ("2001 20 Mon", "%Y %U %a", ...)
should be: wday = 1, yday = 140, mon = 4, mday = 21
is: wday = 1, yday = 139, mon = 4, mday = 20
yearday for `2001 20 Mon' incorrect: 139 instead of 140
monthday for `2001 20 Mon' incorrect: 20 instead of 21
strptime ("2001 21 Mon", "%Y %W %a", ...)
should be: wday = 1, yday = 140, mon = 4, mday = 21
is: wday = 1, yday = 140, mon = 4, mday = 21
___
So there may be a technical mismatch (GNU libc manages to reinterpret standards
in amusing ways) for the %U case but the result is clearly a gain.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list