Comments (3)
这就不是纳秒精度的了,只有毫秒精度
from tscns.
这就不是纳秒精度的了,只有毫秒精度
是的,适用频繁调用,但是精度要求不高的情况。通常日志记录,定时器之类的, 毫秒精度基本够用。
主要是这个方案使用简单,不需要校准,也不需要担心时间跳变之类的问题。
from tscns.
如果只是毫秒精度下面这个足够快
int64_t rdns() {
timespec ts;
::clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
return ts.tv_sec * 1000'000'000 + ts.tv_nsec;
}
from tscns.
Related Issues (12)
- Use constructor instead of init function HOT 1
- TSC计时在超频服务器上的问题 HOT 3
- 含有编译时错误 HOT 1
- 如果不定期calibrate(),int64_t转double做运算有数值溢出或精度损失风险 HOT 1
- Concurrency safe? HOT 1
- 关于sleep影响计时准确性的问题 HOT 1
- Need mfence after builtin_ia32_rtscp HOT 1
- rdns of HOT 2
- do it like the kernel HOT 3
- 请教误差范围 HOT 7
- 请教为什么从rdtscp改回了rdtsc HOT 16
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 tscns.