#ifndef PTIME_H #define PTIME_H #include #include #ifdef __MACH__ #include #include #endif struct PTime { int64_t s; // seconds int64_t m; // milliseconds int64_t n; // nanoseconds }; int64_t setPTime(struct PTime *time, int64_t seconds, int64_t milliseconds, int64_t nanoseconds); int64_t addPTime(struct PTime *time, int64_t seconds, int64_t milliseconds, int64_t nanoseconds); int64_t subPTime(struct PTime *time, int64_t seconds, int64_t milliseconds, int64_t nanoseconds); int64_t getPTime(struct PTime *time); int64_t getPTimeDiff(struct PTime *time_delta, struct PTime *time_a, struct PTime *time_b); void doNanoSleep(int64_t nanoseconds); #endif