clray
view src/timer.cc @ 56:e3b4457dc4d2
added glFinish after swap-buffers to make the program absolutely correct in regards to mediating usage of the shared GL/CL texture image
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 06 Sep 2010 05:40:47 +0100 |
parents | |
children |
line source
1 #include "timer.h"
3 #if defined(unix) || defined(__unix__) || defined(__APPLE__)
4 #include <unistd.h>
5 #include <sys/time.h>
7 long get_msec()
8 {
9 static struct timeval tv0;
10 struct timeval tv;
12 gettimeofday(&tv, 0);
14 if(tv0.tv_sec == 0 && tv0.tv_usec == 0) {
15 tv0 = tv;
16 return 0;
17 }
18 return (tv.tv_sec - tv0.tv_sec) * 1000L + (tv.tv_usec - tv0.tv_usec) / 1000L;
19 }
21 #elif defined(WIN32) || defined(__WIN32__)
22 #include <windows.h>
24 #pragma comment(lib, "winmm.lib")
26 long get_msec()
27 {
28 return timeGetTime();
29 }
30 #endif