c - Is CLOCK_MONOTONIC process (or thread) specific? -
if time using clock_gettime(clock_monotonic,x), call yield (e.g. sched_yield()), clock_monotonic time again, difference in times include time program wasn't running (having yielded), or clock_monotonic track time during program executing? tests seem imply latter, i'd know sure.
also, if clock_monotonic doesn't include time yielded, there monotonic timer (ie. 1 not subject jumps caused ntp) does?
the answer maxim , comments answered second part of question, believe. expand on answer first part, posix 2008 states
if monotonic clock option supported, implementations shall support clock_id of clock_monotonic defined in <time.h>. clock represents monotonic clock system. clock, value returned clock_gettime() represents amount of time (in seconds , nanoseconds) since unspecified point in past (for example, system start-up time, or epoch). point not change after system start-up time.
in particular, note "the monotonic clock system". is, per-system , not per-process, keeps ticking though process not running. also, "this point not change after system start-up time.", again implies keeps ticking regardless of whether particular process running or sleeping.
so, either have found bug in linux implementation, or more likely, in test program.
Comments
Post a Comment