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

Time does not serialize correctly in Crystal .34 #4

Open
srcrip opened this issue Jun 7, 2020 · 1 comment · May be fixed by #5
Open

Time does not serialize correctly in Crystal .34 #4

srcrip opened this issue Jun 7, 2020 · 1 comment · May be fixed by #5

Comments

@srcrip
Copy link

srcrip commented Jun 7, 2020

I think if you want to make a time with seconds now you now need to do something like this:

crystal

struct Time
  def self.from_cannon_io(io)
    utc(seconds: Cannon.decode(io, Int64), nanoseconds: 0)
  end

  def self.to_cannon_io(io)
    io.write_bytes self
    io
  end
end

Basically I think you need to specify a location now. The simplest way is to use UTC.

There might be others too.

srcrip added a commit to srcrip/cannon that referenced this issue Jun 7, 2020
@srcrip srcrip linked a pull request Jun 7, 2020 that will close this issue
@srcrip
Copy link
Author

srcrip commented Jun 7, 2020

Opened a PR with what I think to be an ok fix. There should probably be Time's added to the specs if there isnt already though.

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 a pull request may close this issue.

1 participant