X-Git-Url: https://git.sesse.net/?p=glcapture;a=blobdiff_plain;f=glcapture.c;h=3bf71717756a7bc1ca95e1ac4b2ee81d20b175b0;hp=e4af4083f0b2ccaeeeb3daf0f2802716cad82cc0;hb=132ecccb96ce6f10eb0e64cc4238a0c12eb936e5;hpb=2f7d83839e0ad90cd4476ed5da9fcbf6d5720b62 diff --git a/glcapture.c b/glcapture.c index e4af408..3bf7171 100644 --- a/glcapture.c +++ b/glcapture.c @@ -19,6 +19,7 @@ #define WIDTH 640 #define HEIGHT 480 +#define FPS 50 static char buf[WIDTH * HEIGHT * 3]; static int frameno = 0; @@ -53,7 +54,15 @@ void glXSwapBuffers( Display *dpy, GLXDrawable drawable ) int gettimeofday(struct timeval *tv, struct timezone *tz) { printf("gettimeofday frame %u\n", frameno); - tv->tv_sec = frameno / 50; - tv->tv_usec = ((double)(frameno % 50) / 50) * 1000000; + tv->tv_sec = frameno / FPS; + tv->tv_usec = ((double)(frameno % FPS) / FPS) * 1000000; + return 0; +} + +int clock_gettime(clockid_t clk_id, struct timespec *tp) +{ + tp->tv_sec = frameno / FPS; + tp->tv_nsec = ((double)(frameno % FPS) / FPS) * 1e9; + return 0; }