24 lines
518 B
C
24 lines
518 B
C
#ifndef TIMER_H
|
|
#define TIMER_H
|
|
#include <time.h>
|
|
#include <stdint.h>
|
|
|
|
#ifdef __MACH__
|
|
#include <mach/clock.h>
|
|
#include <mach/mach.h>
|
|
#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 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
|