-
Notifications
You must be signed in to change notification settings - Fork 108
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
Add a DateTime32 type for 32-bit serialized times #2210
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! I added two minor suggestions, but they are optional.
One question though, would it make sense to also add Add
and Sub
implementations? I can do that in a separate PR if you want 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some suggestions per @jvff's comment but otherwise looking good 😎
I'd prefer to do the calculations in Also the |
Looks like Deirdre is working on other things right now, so I went ahead and merged this PR so we can make progress. |
Motivation
In #2178, we want to modify the last seen times gossiped by peers.
But the
chrono::DateTime<Utc>
type that we're using has a ~56 bit range, so we can easily generate times that don't serialize when we go to send them to peers.This breaks one of Zebra's design principles: invalid data should be unrepresentable.
Solution
Implement part of #2171:
DateTime32
typeMetaAddr.last_seen
The code in this pull request has:
Review
@jvff can review this PR, it helps simplify #2178.
Follow Up Work
Replace Zebra's other 32-bit times with
DateTime32
#2211