Skip to content

Conversation

@boivie
Copy link
Collaborator

@boivie boivie commented Dec 19, 2025

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.

@boivie boivie force-pushed the feature-sockettime branch from 044621a to 7ef6f5b Compare December 19, 2025 19:57
@boivie boivie changed the title jUse new SocketTime replacing Instant Use new SocketTime replacing Instant Dec 19, 2025
@boivie boivie requested a review from lndmrk December 19, 2025 19:58
@boivie boivie force-pushed the feature-sockettime branch 3 times, most recently from c8d1e38 to f301aff Compare December 22, 2025 21:29
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.
@boivie boivie force-pushed the feature-sockettime branch from f301aff to 3bd1ce6 Compare December 22, 2025 21:40
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.

1 participant