Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Nov 2024 10:36:14 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 282916] The strptime() function in libc/stdtime parses an incorrect wday value with the %x format for dates after 12/31/00
Message-ID:  <bug-282916-227@https.bugs.freebsd.org/bugzilla/>

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

            Bug ID: 282916
           Summary: The strptime() function in libc/stdtime parses an
                    incorrect wday value with the %x format for dates
                    after 12/31/00
           Product: Base System
           Version: 14.1-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: erkki.moorits@mail.ee
 Attachment #255388 text/plain
         mime type:

Created attachment 255388
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D255388&action=
=3Dedit
Test code for strptime(..., "%x", ...)

When I use strptime() input descriptor "%x" to decode date, then after 12/3=
1/00
strptime() decodes wrong wday.

Here are the different test results from the attached test program.

Expected decoded values are (reference tests on Ubuntu Linux):
12/31/00:
        Time: 00:00:00          Date: 2000-12-31
        Wday: 0 Yday: 365 (DST 0 Zone [(null)] offset 0)

01/01/01:
        Time: 00:00:00          Date: 2001-01-01
        Wday: 1 Yday: 000 (DST 0 Zone [(null)] offset 0)

01/02/01:
        Time: 00:00:00          Date: 2001-01-02
        Wday: 2 Yday: 001 (DST 0 Zone [(null)] offset 0)


Actual values on FreeBSD 14.1-RELEASE-p5 GENERIC amd64:
12/31/00:
        Time: 00:00:00          Date: 2000-12-31
        Wday: 0 Yday: 365 (DST 0 Zone [(null)] offset 0)

01/01/01:
        Time: 00:00:00          Date: 2001-01-01
        Wday: 0 Yday: 000 (DST 0 Zone [(null)] offset 0)

01/02/01:
        Time: 00:00:00          Date: 2001-01-02
        Wday: 1 Yday: 001 (DST 0 Zone [(null)] offset 0)

Also wday values from %c and %x are different (first lines are decoded by u=
sing
%c, last by using %x):
Fri Mar  4 20:05:34 2005:
        Time: 20:05:34          Date: 2005-03-04
        Wday: 5 Yday: 062 (DST 0 Zone [(null)] offset 0)

03/04/05:
        Time: 00:00:00          Date: 2005-03-04
        Wday: 4 Yday: 062 (DST 0 Zone [(null)] offset 0)

--=20
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-282916-227>