-
Notifications
You must be signed in to change notification settings - Fork 5
Use new SocketTime replacing Instant #45
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
Merged
Merged
+670
−616
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
044621a to
7ef6f5b
Compare
f301aff to
3bd1ce6
Compare
lndmrk
approved these changes
Jan 8, 2026
Instant is a complicated type as it's opaque, and only useful with Duration. It cannot be created from a value, and it cannot be serialized and deserialized, and works poorly when interfacing C++. It typically represents the current time. This change introduces a type called SocketTime that represent a point in time relative to the socket's creation time. It's a strong type, wrapping an u64 representing nanoseconds since the socket was created. This simplifies interfacing with C++, and overall simplifies the API.
88c50fa to
ce167e8
Compare
lndmrk
approved these changes
Jan 8, 2026
ce167e8 to
07a187c
Compare
lndmrk
approved these changes
Jan 8, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Instant is a complicated type as it's opaque, and only useful with Duration. It cannot be created from a value, and it cannot be serialized and deserialized, and works poorly when interfacing C++. It typically represents the current time.
This change introduces a type called SocketTime that represent a point in time relative to the socket's creation time. It's a strong type, wrapping a Duration, and with the definition that it's zero when the socket is created, the current time no longer has to be passed to the socket constructor.
This simplifies interfacing with C++, and overall simplifies the API.
CXX FFI is updated in this change as well, to see how it's used. Note that the CXX FFI uses a u64 (in nanoseconds) as its view of duration (everywhere). That limits the socket lifetime to 585 years, which is okey. The Rust API has the full Duration.