Comments (1)
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)
- Crash on iOS HOT 7
- Commit for version 0.12.3 it not reachable from main branch HOT 1
- Failed to build version 0.9.1 HOT 1
- Does not build on MIPS and ARMv5 HOT 7
- Check for RDTSCP support doesn't work HOT 2
- Switch to CLOCK_BOOTTIME and friends to improve accuracy. HOT 2
- Intermittent panic due to overflowing our source calibration denominator. HOT 5
- Comparing to `minstant` HOT 9
- Can `Instant`s be `NonZeroU64`? HOT 4
- Adding support for TSC on ARM. HOT 4
- Fails to build on x86 without SSE2 HOT 2
- Allow Instant to be used atomically HOT 3
- Quanta Clock is off by a factor of 1000 in web browsers
- RUSTSEC-2020-0168: mach is unmaintained HOT 2
- Much slower than std version in case of high contention HOT 2
- Can Clock provide `delta_as_nanos`? HOT 7
- Does it make sense to pin `Upkeep` thread? HOT 4
- Populate recent time once before starting upkeep thread.
- On macOS arm64, `quanta::Instant::elapsed` method tends to return a shorter duration than `std::time::Instant::elapsed` does HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quanta.