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

Fix Time struct #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fix Time struct #5

wants to merge 2 commits into from

Conversation

srcrip
Copy link

@srcrip srcrip commented Jun 7, 2020

Fixes #4

@Papierkorb
Copy link
Owner

Hello, thank you for your contribution!

Cannon doesn't guarantee any kind of compatibility between versions, so it's fine to wreak havoc change things! :)

I think Time should carry the timezone over, including any other data it offers (Like the nanoseconds). deserialize(serialize(some_object)) == some_object should always be true as long it's feasible. Could you look into that?

Cheers!

Handle Time::Span, Time::Location, and Time's location and nanoseconds fields
@srcrip
Copy link
Author

srcrip commented Jun 7, 2020

OK I made some changes I think are good. I'm not quite sure if I've done it correctly though.

include Cannon::FastAuto

def self.from_cannon_io(io)
new(Cannon.decode(io, Int64))
new(seconds: Cannon.decode(io, Int64), nanoseconds: 0)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the nanoseconds?

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

Successfully merging this pull request may close these issues.

Time does not serialize correctly in Crystal .34
2 participants