dungeon_crawler

view prototype/src/timer.cc @ 69:45172d087ebe

fixed some windows compatibility crap fixed a terrible stack overrun in psys (TODO: remember to fix in libpsys too)
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 07 Oct 2012 03:42:44 +0200
parents 862461b686f4
children
line source
1 #ifndef _MSC_VER
2 #include <chrono>
3 #include "timer.h"
5 using namespace std::chrono;
7 static bool timer_initialized;
8 static time_point<steady_clock> start_time;
10 unsigned long get_time_msec(void)
11 {
12 if(!timer_initialized) {
13 start_time = steady_clock::now();
14 timer_initialized = true;
15 }
17 auto dur = steady_clock::now() - start_time;
18 return duration_cast<milliseconds>(dur).count();
19 }
20 #else
21 #include <Windows.h>
23 unsigned long get_time_msec(void)
24 {
25 return GetTickCount();
26 }
27 #endif