Skip to content

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

Merged
Enet4 merged 1 commit intomasterfrom
bug/core/time-leap-second
Oct 30, 2023
Merged

[core] Handle leap second from chrono time types correctly#428
Enet4 merged 1 commit intomasterfrom
bug/core/time-leap-second

Conversation

@Enet4
Copy link
Copy Markdown
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
@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.

1 participant