mirror of
https://github.com/Harshit-Dhanwalkar/AsciiCam.git
synced 2026-06-09 10:25:12 +02:00
21 lines
379 B
C
21 lines
379 B
C
#ifndef TIMING_H
|
|
#define TIMING_H
|
|
|
|
#include <time.h>
|
|
|
|
typedef struct {
|
|
long samples[16]; // frame duration (ns) ring buffer
|
|
int head;
|
|
int count;
|
|
} fps_counter_t;
|
|
|
|
// Initialize framerate control
|
|
void timing_init(int fps);
|
|
|
|
void timing_sleep(struct timespec *start_time);
|
|
|
|
void fps_push(fps_counter_t *fc, long elapsed_ns);
|
|
|
|
double fps_get(const fps_counter_t *fc);
|
|
|
|
#endif
|