#include "clock.h" #include void time_(clockid_t clock, long* t) { struct timespec a; clock_gettime(clock, &a); t[0] = a.tv_sec ; t[1] = a.tv_nsec; } void clock_readtime_monotonic(long* t) { time_(CLOCK_MONOTONIC, t); } void clock_readtime_realtime(long* t) { time_(CLOCK_REALTIME, t); } void clock_readtime_processtime(long* t) { time_(CLOCK_PROCESS_CPUTIME_ID , t); } void clock_readtime_threadtime(long* t) { time_(CLOCK_THREAD_CPUTIME_ID , t); } void res_(clockid_t clock, long* t) { struct timespec a; clock_getres(clock, &a); t[0] = a.tv_sec ; t[1] = a.tv_nsec; } void clock_readres_monotonic(long* t) { res_(CLOCK_MONOTONIC, t); } void clock_readres_realtime(long* t) { res_(CLOCK_REALTIME, t); } void clock_readres_processtime(long* t) { res_(CLOCK_PROCESS_CPUTIME_ID , t); } void clock_readres_threadtime(long* t) { res_(CLOCK_THREAD_CPUTIME_ID , t); }