#ifndef _TIMERHELPER_H_ #define _TIMERHELPER_H_ #include #ifndef __always_inline #define __always_inline #endif ///subtract b from a to get difference __always_inline struct timespec timespec_sub(struct timespec a,struct timespec b){ struct timespec ret; ret.tv_sec = a.tv_sec - b.tv_sec; ret.tv_nsec = a.tv_nsec - b.tv_nsec; if (ret.tv_nsec < 0){ ret.tv_sec--; ret.tv_nsec += 1000000000L; } return ret; } #endif