Does Linux provide a monotonically increasing clock to applications Does Linux provide a monotonically increasing clock to applications unix unix

Does Linux provide a monotonically increasing clock to applications


Use the POSIX clock_gettime() function with CLOCK_MONOTONIC. See the man page for details.


There is clock_gettime:

struct timespec tp;clock_gettime(CLOCK_MONOTONIC, &tp);