Closed sedrik closed 10 months ago
You can add support for any format description, including the unix_timestamp
component.
time::serde::format_description!(timestamp_millis, OffsetDateTime, "[unix_timestamp precision:millisecond]");
Oh I had completely missed that. Awesome stuff! :)
Here is a link to the documentation for anyone from the future that stumbles upon this. https://docs.rs/time/0.3.31/time/serde/macro.format_description.html
Hi
For an API I am working with I get Unix timestamps in millisecond precision as integers so I wrote the following code to handle that case (as I could not find support for it in the time crate). While my code is far from ideal (and not ready to be brought into the crate itself) I figured it might be a good starting point for future support.
A lot of things could probably be improved (I have never been good at understanding the Serializer/Deserializer implementations of Serde), especially the error handling is really bad and should be improved before this could be added as a feature.
Feel free to close this issues if this is not interesting.