-
Notifications
You must be signed in to change notification settings - Fork 446
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
fix: adjustments to the datetime library #6431
Conversation
Mathlib CI status (docs):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the leap
change! Hopefully, I will eventually be able to swap out Lake's TOML implementation of DateTime
for the Std
one.
Co-authored-by: Mac Malone <[email protected]>
@algebraic-dev, please remember to add |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not like that PlainTime
is parameterized now. I think that forcing dependent types on users here makes for bad ergonomics and it's very easy to have inconsistent APIs that are annoying to work around:
import Std.Time
open Std.Time
#eval PlainTime.fromLeanTime24Hour "12:00:00" -- Except.ok ⟨true, time("12:00:00.000000000")⟩
#eval PlainTime.now -- ⟨false, time("15:39:04.310660681")⟩
As far as ISO 8601 is concerned, there is only one kind of clock time -- the one you're calling PlainTime true
/LeapTime
.
I see two ways forward here:
- carefully review the API, change all functions that currently return a
Sigma PlainTime
to returnPlainTime true
orPlainTime false
and add conversion functions betweenPlainTime true
andPlainTime false
- Redefine
PlainTime
to what is calledPlainTime true
today.
I much prefer the second option, but I'm interested in everyone's opinions.
Co-authored-by: Markus Himmel <[email protected]>
Co-authored-by: Markus Himmel <[email protected]>
I preferred the second option and now the |
This PR fixes the
Repr
instance of theTimestamp
type and changes thePlainTime
type so that it always represents a clock time that may be a leap second.Repr
.PlainTime
type now always represents a clock time that may be a leap second.readlink -f
toIO.FS.realPath