Where can I find documentation about that? Which one has more precision? Which one has more performance? What is the difference among them?
Asked
Active
Viewed 3,235 times
0
-
Did you see the man page http://www.kernel.org/doc/man-pages/online/pages/man2/clock_gettime.2.html? – Nikolai Fetissov Jun 06 '12 at 19:31
-
See http://stackoverflow.com/questions/3523442/difference-between-clock-realtime-and-clock-monotonic – NPE Jun 06 '12 at 19:36
-
SGI one is only for ... SGI platform. See http://lxr.free-electrons.com/ident?i=CLOCK_SGI_CYCLE – Nikolai Fetissov Jun 06 '12 at 19:42
-
1"Which one has better performance?" is always the wrong question to ask when the choices have *fundamentally different semantics*. This question is akin to "What is the difference between `sin` and `sqrt`? Which is faster?" – R.. GitHub STOP HELPING ICE Jun 06 '12 at 19:56
-
http://stackoverflow.com/questions/3523442/difference-between-clock-realtime-and-clock-monotonic – Ciro Santilli OurBigBook.com Dec 17 '16 at 23:04
1 Answers
2
Here is a nice test program to investigate the differences in the various system clocks:
http://lwn.net/Articles/105582/
The resolution is the same on all of them, but they each measure different things.

embedded.kyle
- 10,976
- 5
- 37
- 56
-
According to the output of the test in the link above, which one is the fastest? I am not sure what each of those numbers means. :| – JohnPristine Jun 06 '12 at 19:51
-
The resolution is the same in each case. Each tick = 0.000000040 (I believe that's in nanoseconds). So they all run the same speed. But each has a different reference or starting point. – embedded.kyle Jun 06 '12 at 19:55
-
They don't run at the same "speed", I don't think -- not if you measure speed over a length of time. The monotonic clock never adjusts back, it will slow down and speed up to catch up on clock adjustments done by ntp and similar clock synchronizers. The nonmonotonic one can jump back. The "test program" you reference appears not to run for extended periods of time, and wasn't run in the presence of an NTP or PTP daemon that syncs the clock. – Kuba hasn't forgotten Monica Jun 07 '12 at 00:25