-
Notifications
You must be signed in to change notification settings - Fork 170
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
Timestamp serialization fails on large deltas from epoch #6892
Comments
@rorbech & @cmelchior I believe the Java SDK is actually impacted by this. For Dart it is just some test cases that fails. |
This was referenced Aug 15, 2023
This also fails for Kotlin's RealmInstant.MIN. Callint:
With:
Will generate this string:
|
Serialization of Kotlin's RealmInstant.MIN is fixed by #7934. |
I guess I can close my PR then |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Realm represent timestamps as 64 bit seconds offset from epoch (1970) and a 32 bit nano-seconds component. Hence realm can represent offsets from epoch up to (1 << 63)s / 86400s/day = 9223372036854689408 days.
The buffer used to serialize is just 32 bytes. From
timestamp.hpp:202
:The largest year representable with a realm timestamp is roughly (1 <<63)s / 86400s/day / 365day/years = 292471208677years. Hence we need 13 (12 + 1 for sign) bytes just for the years. Then 14 for
%m-%d %H:%M:%S
and another 10 for the nanoseconds and the preceding.
which is 37 altogether.A true iso8601 serialized utc timestamp also has a
Z
at the end andT
separating date from time instead of a space.Core version: 13.17.2
The text was updated successfully, but these errors were encountered: