Open doziestar opened 3 months ago
Attention: Patch coverage is 97.43590% with 1 line in your changes missing coverage. Please review. |
Files | Patch % | Lines |
---|---|---|---|
src/time.rs | 97.14% | 1 Missing :warning: |
:loudspeaker: Thoughts on this report? Let us know!
Description
I added a new
TimestampInterpretation
enum and updates theTimeConfig
to allow us specify how timestamps should be interpreted. This change provides more flexibility in parsing timestamps, especially for systems that may receive timestamps in different formats.Changes
TimestampInterpretation
enum withAuto
andAlwaysSeconds
variants.TimeConfig
to include atimestamp_interpretation
field.TimeConfigBuilder
to allow setting thetimestamp_interpretation
.DateTime::from_timestamp_with_config
to handle different interpretation modes.How to Use
Setting up TimeConfig with TimestampInterpretation
Anyone can now specify how they want timestamps to be interpreted when creating a
TimeConfig
:Notes
Auto
mode behaves like the previous implementation, automatically detecting if a timestamp is in seconds or milliseconds based on its magnitude.AlwaysSeconds
mode always interprets the timestamp as seconds, which may result inDateTooLarge
errors for timestamps that would previously have been interpreted as milliseconds.