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

feat: add NAIVE_UNIX_EPOCH constant to PrimitiveDateTime #569

Closed
wants to merge 1 commit into from

Conversation

xoac
Copy link

@xoac xoac commented Apr 20, 2023

I am not sure if this is acceptable in terms of interface time crate want to provide. I think NAIVE prefix is nice suggestion that developer is responsible for correctness of logic here and such constant can be useful.

@codecov
Copy link

codecov bot commented Apr 20, 2023

Codecov Report

Merging #569 (88cf46f) into main (4507d07) will increase coverage by 0.0%.
The diff coverage is 100.0%.

@@          Coverage Diff          @@
##            main    #569   +/-   ##
=====================================
  Coverage   95.7%   95.7%           
=====================================
  Files         79      79           
  Lines       8768    8780   +12     
=====================================
+ Hits        8394    8406   +12     
  Misses       374     374           
Impacted Files Coverage Δ
time/src/date_time.rs 94.6% <ø> (ø)
time/src/primitive_date_time.rs 100.0% <ø> (ø)
time/src/weekday.rs 100.0% <100.0%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jhpratt
Copy link
Member

jhpratt commented Apr 21, 2023

"Unix epoch" fundamentally requires a time zone, as it measures time since 1970-01-01 0:00 UTC. If a user wishes to use the value without a time zone, it can be trivially constructed (at compile-time) using datetime!(1970-01-01 0:00).

In the future, I intend on implementing additional functionality such that it's possible to have a statically-known offset with zero runtime overhead. However, this likely requires language features that are not near stabilization.

@jhpratt jhpratt closed this Apr 21, 2023
@jhpratt jhpratt added C-feature-request Category: a new feature (not already implemented) A-core Area: anything not otherwise covered labels Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: anything not otherwise covered C-feature-request Category: a new feature (not already implemented)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants