#ifndef TIMER_H #define TIMER_H #include #include #include #include #define NSEC_PER_SEC 1000000000 struct timespec subts(struct timespec t1, struct timespec t2); struct timespec addts(struct timespec t1, struct timespec t2); double timespec_to_double(struct timespec ts); //appended GH just incase theres a conflict with anything //else named "Timer" typedef struct GHTimer { struct timespec start; struct timespec current; struct timespec pause_start; struct timespec pause_current; struct timespec diff; int running; int paused; } GHTimer; void ghtimer_start(GHTimer *timer); void ghtimer_pause(GHTimer *timer); void ghtimer_resume(GHTimer *timer); void ghtimer_stop(GHTimer *timer); void ghtimer_reset(GHTimer *timer); void ghtimer_tick(GHTimer *timer); struct timespec ghtimer_time(GHTimer *timer); void ghtimer_timestring(GHTimer *timer, char *buffer); #endif