on-internet
← Community

clockid_t (clock_gettime first argument) portability

Stack Overflow ·

Most POSIX-compatible systems provide a function to get or set one of high-resolution timers: int clock_gettime(clockid_t clock_id, struct timespec *tp); Documentation for each system usually lists several symbolic names as possible clock_id values, but actual numeric values are never mentioned. It turns out that not only the numeric values are different across various systems, but symbolic names are also not the same for the same meaning. Even more so, not all the clocks actually supported by a system are defined in time.h (bits/time.h) ­— some are only defined in, let's say, linux/time.h. Th

Comments

Sign in or sign up to comment and upvote.

No comments yet.