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

[core] Handle leap second from chrono time types correctly #428

Merged
merged 1 commit into from
Oct 30, 2023

Conversation

Enet4
Copy link
Owner

@Enet4 Enet4 commented Oct 30, 2023

chrono 0.4.31 has stricter constraints in time constructor functions, so the cases where a leap second is not allowed are already covered here.

This in turn revealed that dicom-core is not accepting valid times with a leap second from chrono because they are represented differently: whereas our DICOM date time types represent leap seconds as having 60 seconds, like in the encoding of DICOM VRs DT and TM, chrono represents them instead as sub-second fractions larger than 1 second. This requires the seconds and microseconds from these types to be adapted to fit in DicomTime and DicomDateTime.

Resolves the CI error detected in #427.

Summary

  • update chrono to ^0.4.31
  • clarify documentation of DicomTime::from_hms_micro
  • fix TryFrom impls for DicomTime and DicomDateTime so that leap years in chrono types are correctly accounted for

- update chrono to ^0.4.31
- clarify documentation of `DicomTime::from_hms_micro`
- fix `TryFrom` impls for `DicomTime` and `DicomDateTime`
  so that leap years in chrono types are correctly accounted for
@Enet4 Enet4 added bug This is a bug A-lib Area: library C-core Crate: dicom-core labels Oct 30, 2023
@Enet4 Enet4 merged commit 78a5f52 into master Oct 30, 2023
4 checks passed
@Enet4 Enet4 deleted the bug/core/time-leap-second branch October 30, 2023 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lib Area: library bug This is a bug C-core Crate: dicom-core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant