Skip to content

fix(date): improve caching accuracy #3887

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Patryk27
Copy link

@Patryk27 Patryk27 commented May 8, 2025

CachedDate gets updated every second, but the current logic doesn't take into account milliseconds and nanoseconds - if the application starts at 12:00:00.600, hyper will report date: ...T120000 up until 12:00:01.600, which is overzealous.

We can sidestep this by subtracting the nanoseconds part (which includes milliseconds) from the time passed to CachedDate::update(), essentially rounding self.next_update to the beginning of the next closest second.

`CachedDate` gets updated every second, but the current logic doesn't
take into account milliseconds - if the application starts at
`12:00:00.600`, hyper will report `date: ...T120000` up until
`12:00:01.599`, which is overzealous.

We can sidestep this by subtracing the nanoseconds part (which includes
milliseconds) from the time passed to `CachedDate::update()`.
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