clray
view src/timer.cc @ 41:057b8575a1c1
- changed the membuffer into an imagebuffer for the non-GL/CL-interop case
- fixed the segfault
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 27 Aug 2010 20:39:55 +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