Skip to content
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

Missing Timestamp extension type #59

Open
didactic-drunk opened this issue Jun 10, 2019 · 2 comments
Open

Missing Timestamp extension type #59

didactic-drunk opened this issue Jun 10, 2019 · 2 comments

Comments

@didactic-drunk
Copy link
Contributor

https://github.com/msgpack/msgpack/blob/master/spec.md#formats-timestamp

I suggest emitting the ext timestamp format when serializing UTC Time rather than a custom format potentially solving issues with #58.

@kostya
Copy link
Collaborator

kostya commented Jun 11, 2019

you can add custom time serialization for ext: example: https://github.com/crystal-community/msgpack-crystal/blob/master/examples/ext.cr, not sure it should be by default

@didactic-drunk
Copy link
Contributor Author

didactic-drunk commented Jun 12, 2019

I was surprised when my fractional seconds disappeared using the default packing method. I'm not sure if that's a bug or missing documentation but seems to violate the POLS, especially when .to_s doesn't show fractional seconds so Time's look the same when printing but comparisons fail.

Should there be a standard way to use MessagePack standard extension? Like:
@[MessagePack::Field(key: "my_key", timestamp: true)]
or a default name for the encoder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants