Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jul 2014 21:53:44 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 137307] [libc] [patch] Enhance strptime(3) to support %U and %W
Message-ID:  <bug-137307-8-h0J9XrXWMj@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-137307-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-137307-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=137307

--- Comment #2 from Pedro F. Giffuni <pfg@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-137307-8-h0J9XrXWMj>