NetworkClock: fix duration arithmetic and improve descriptions - #125
Open
rpaulo wants to merge 1 commit into
Open
NetworkClock: fix duration arithmetic and improve descriptions#125rpaulo wants to merge 1 commit into
rpaulo wants to merge 1 commit into
Conversation
rpaulo
commented
Aug 31, 2026
Contributor
- Fix float scaling, division, and shift operators to avoid premature integer truncation and preserve precision
- Add hours/days factories, coarse-unit descriptions, fractional microseconds, and roundedUpMilliseconds helper
- Make Instant subtraction return a NetworkDuration and render Instants using fine (sub-minute) units
- Cache nanosecond-per-unit constants and expand test coverage
rpaulo
requested review from
agnosticdev,
ekinnear,
kkuk24 and
tfpauly
as code owners
August 31, 2026 23:47
rpaulo
force-pushed
the
network-clock-fixes
branch
from
August 31, 2026 23:49
cfd5092 to
8a01ebe
Compare
tfpauly
approved these changes
Aug 31, 2026
- Fix float scaling, division, and shift operators to avoid premature integer truncation and preserve precision - Add hours/days factories, coarse-unit descriptions, fractional microseconds, and roundedUpMilliseconds helper - Make Instant subtraction return a NetworkDuration and render Instants using fine (sub-minute) units - Cache nanosecond-per-unit constants and expand test coverage
rpaulo
force-pushed
the
network-clock-fixes
branch
from
September 1, 2026 00:24
8a01ebe to
af3309b
Compare
agnosticdev
approved these changes
Sep 1, 2026
agnosticdev
left a comment
Collaborator
There was a problem hiding this comment.
I would recommend going through and adding & to all of the places where its safe to do so since these values are often used in the hot path. It doesn't seem like much but it removes a surprising amount of instructions when you do so.
rnro
approved these changes
Sep 1, 2026
rnro
left a comment
Contributor
There was a problem hiding this comment.
Looks good overall, I agree with Matt's comment about &+
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
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.