Code Monkey home page Code Monkey logo

Comments (1)

tobz avatar tobz commented on August 24, 2024

Apologies for the delay in response here. I saw this issue when you filed it, immediately looked it over, did some calculations, and then.... forgot to respond. 😭

It does indeed appear like there is potentially a calibration issue here, or that we're simply hitting the limits of what the calibration loop can provide. Calibration cannot cope with changes to system time through mechanisms like NTP, which may skew time forwards or backwards at a rate faster or slower than the actual local passage of time.

All of that said, I'd say your test case is reasonable. Running it locally, I can observe the same slow drift over time, in which the degree that it drifts changes between runs. I had also observed a few runs where the drift was sinusoidal, likely related to legitimate NTP adjustment/tracking.

Replacing quanta with simple calls to Instant::now all but eliminates the drift, locking it tightly to a few hundred nanoseconds plus or minus over the course of a few minutes. This is not surprising, as Instant::now is based on CLOCK_MONOTONIC for unix-y platforms, where it will be subject to NTP adjustments (but simply ensured to at least only change monotonically), and so is likely to stay much closer to SystemTime which is similarly disciplined by NTP.

This definitely has me thinking about re-examining the use of TSC overall, but I would suggest just utilizing SystemTime/Instant for the time being since that should be accurate enough if you have a strict need to present a timestamp that is wall clock-referenced.

from quanta.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.