-
-
Notifications
You must be signed in to change notification settings - Fork 281
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
Serde support for millisecond precision timestamps is broken by the lack of truncating i128 to i64. #721
Comments
While the |
Can it not? Storing millisecond offset from 01.01.1970 as an i64 should be totally fine for another 200 years, if I'm mathing this correctly. |
The supported range of years is ±9999 by default and ±999,999 with the |
Though I do agree that not supporting 128 bit integers, and offering to jump straight to bigint as a solution is one of choices of all time. In the use case where this came up for us, we're writing timestamps to Mongo, which doesn't support 128 bit integers either. |
So…math-wise, 2⁶³ milliseconds is larger than the 1 million supported. As such it was an oversight on my end when this was first implemented. This does not apply to microseconds and nanoseconds, which would be 292,000 years and 292 years respectively. I'd accept a pull request that duplicates the |
Causes "i128 is not supported" runtime errors when used with
serde_json
and/orbson
.time/time/src/serde/timestamp/milliseconds.rs
Line 20 in 0a50218
serde-rs/json#846
The text was updated successfully, but these errors were encountered: