-
Notifications
You must be signed in to change notification settings - Fork 176
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
Add lightweight timestamp-to-ISO conversion function #2034
Comments
CC @Manishearth |
@samchen61661: Manish will post a suggestion on how to easily implement this function in Note that we likely want this to work bi-directionally. ISO-to-timestamp is probably what we need first. |
We don't have this but it ought to be easy to implement, we already have internal "from_fixed" and "to_fixed" functions which convert to and from "fixed" dates, counted as days since 1 AD. So adding this function to icu4x/components/calendar/src/iso.rs Lines 444 to 499 in 38f2736
|
Note: I think the desired output for the string-to-integer function is a signed number of minutes since Januay 1, 1970 in local time. Probably an |
@samchen61661 Is this complete? |
Yeah, marked it as closed |
For time zone calculations, we need to store local datetimes (also known as civil datetimes or plain datetimes) for metazone cutoffs in the data provider.
If we store them as an ISO string, like "1988-04-03 04:01", we need either 12 or 16 bytes. It would be more efficient to store them as a "local timestamp", or the duration between the local datetime and 1970-01-01T00:00, most likely measured in minutes and stored in a
u32
. (Note: we should be very careful on using the term "local timestamp", because that can be really confusing terminology.)I think this conversion function could go in
icu_calendar
.The text was updated successfully, but these errors were encountered: