clock.h (432B)
1 #ifndef PH_ENGINE_CLOCK_H 2 #define PH_ENGINE_CLOCK_H 3 4 #include <stdint.h> 5 6 /* Credit is nanoseconds multiplied by the requested tick rate. */ 7 typedef struct { uint64_t credit; } PhClock; 8 9 /* Returns fixed ticks due, retaining fractional credit. Excess elapsed time 10 * beyond max_steps is discarded. Keep hz constant until the clock is reset. */ 11 int ph_clock_steps(PhClock *clock, uint64_t elapsed_ns, int hz, int max_steps); 12 13 #endif