Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed epoch date decoding being affected by the local time zone #218

Merged
merged 3 commits into from
Feb 21, 2024

Conversation

agronholm
Copy link
Owner

Fixes #209.

@coveralls
Copy link

coveralls commented Feb 18, 2024

Coverage Status

coverage: 92.541% (-0.8%) from 93.37%
when pulling a7be3a6 on fix-date-handling
into 33f732c on master.

Copy link
Contributor

@meejah meejah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, at least now does the same thing as the Python side, AFAICT

@@ -1000,6 +1003,9 @@ PyInit__cbor2(void)

#undef INTERN_STRING

if (!_CBOR2_date_ordinal_offset &&
!(_CBOR2_date_ordinal_offset = PyLong_FromLong(719163)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be helpful (to me, who doesn't know CBOR expect as a user) to know what this magic number means.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the CBOR definition for semantic tag 100. 719163 is the number of days between the minimum supported CBOR date and the minimum supported Python date ordinal (which starts from January 1 of year 1).

@agronholm agronholm merged commit 6fb8469 into master Feb 21, 2024
13 of 14 checks passed
@agronholm agronholm deleted the fix-date-handling branch February 21, 2024 20:09
@agronholm
Copy link
Owner Author

Turns out the call was faulty and caused the C extension to fail compilation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failing unit-test
3 participants