Closed junderw closed 3 months ago
Yes, that sounds right. Are you not using any of chrono's serde implementations?
Unfortunately, the library is a bit lower level than serde.
(There exists a serde library on top of the encoding and decoding (using Read and Write extension traits))
The encoding of timestamps is pretty straightforward though, the only oddity was the protocol specifically states that nanoseconds must not be 1 billion or over.
Outside of this behavior, it's basically just a binary encoding of the seconds and nanoseconds value and not that difficult to reason about.
Thanks for the answer!
Context (which itself links to a PR trying to encode and decode
chrono::DateTime
with message pack): https://github.com/msgpack/msgpack/issues/339Message Pack only encodes Unix timestamp, so in the case where nanoseconds is 1 billion or over, is it correct that I should modulo 1 billion and add 1 second to the seconds value?