According to the clock () man page on POSIX platforms, the value of the CLOCKS_PER_SEC macro should be 1,000,000. As you say, the return value you get from clock () is a multiple of 10,000, which means that the resolution is 10 ms.
Also note that clock () on Linux returns the approximate processor time used by the program. On Linux, the scheduler statistics are displayed again when the scheduler starts at CONFIG_HZ. Therefore, if the periodic timer is 100 Hz, you get statistics on processor time consumption with a resolution of 10 ms.
The measurements on the wall are not related to this and can be much more accurate. clock_gettime (CLOCK_MONOTONIC, ...) on a modern Linux system provides nanosecond resolution.
janneb
source share