Page MenuHomeFreeBSD

strptime: Fix day-of-week calculation.
ClosedPublic

Authored by des on Dec 7 2024, 1:35 PM.
Tags
None
Referenced Files
F153802451: D47977.id147677.diff
Thu, Apr 23, 9:08 PM
F153793420: D47977.id.diff
Thu, Apr 23, 7:19 PM
Unknown Object (File)
Wed, Apr 22, 11:45 AM
Unknown Object (File)
Mon, Apr 20, 5:43 PM
Unknown Object (File)
Mon, Apr 20, 12:55 PM
Unknown Object (File)
Sat, Apr 18, 9:26 AM
Unknown Object (File)
Tue, Apr 14, 6:22 PM
Unknown Object (File)
Tue, Apr 14, 12:45 PM
Subscribers

Details

Summary

The day-of-week calculation used the raw year value without adjusting
for TM_YEAR_BASE, so it was off by one for 300 years out of every 400;
it just happened to be correct for 1901 through 2000. It also used a
loop where a simple addition would have sufficed.

While here, simplify our version of Gauss's algorithm, and document
that we assume the Gregorian calendar.

MFC after: 1 week
PR: 282916

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 61023
Build 57907: arc lint + arc unit

Event Timeline

des requested review of this revision.Dec 7 2024, 1:35 PM
This revision is now accepted and ready to land.Dec 7 2024, 1:59 PM

Looks good! Thank you for the test case. :-)

This revision was automatically updated to reflect the committed changes.