My conclusion is that the old times system call is the thing to switch back to. It is old fashioned, but looks atomic to me. That is the counters can tick over while you are getting it, but since they are all int sized, they won't wrap in funny ways. You have to use the sysconf library function to get the number of clock ticks per second (_SC_CLK_TCK).