timesynk/engine/sdl/timer.h

24 lines
546 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
};
inline int64_t setPTime(struct PTime *time, int64_t seconds, int64_t milliseconds, int64_t nanoseconds);
inline int64_t getPTime(struct PTime *time);
inline int64_t getPTimeDiff(struct PTime *time_delta, struct PTime *time_a, struct PTime *time_b);
inline void doNanoSleep(int64_t nanoseconds);
#endif