dungeon_crawler
annotate prototype/src/timer.cc @ 79:110b2af4b9d8
fixed the shader non-conformity by explicitly converting 2.2 to vec3 before passing it to pow for the texel inverse-gamma thing
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 27 Oct 2012 01:54:39 +0300 |
parents | 862461b686f4 |
children |
rev | line source |
---|---|
nuclear@69 | 1 #ifndef _MSC_VER |
nuclear@38 | 2 #include <chrono> |
nuclear@38 | 3 #include "timer.h" |
nuclear@38 | 4 |
nuclear@38 | 5 using namespace std::chrono; |
nuclear@38 | 6 |
nuclear@38 | 7 static bool timer_initialized; |
nuclear@38 | 8 static time_point<steady_clock> start_time; |
nuclear@38 | 9 |
nuclear@38 | 10 unsigned long get_time_msec(void) |
nuclear@38 | 11 { |
nuclear@38 | 12 if(!timer_initialized) { |
nuclear@38 | 13 start_time = steady_clock::now(); |
nuclear@38 | 14 timer_initialized = true; |
nuclear@38 | 15 } |
nuclear@38 | 16 |
nuclear@38 | 17 auto dur = steady_clock::now() - start_time; |
nuclear@38 | 18 return duration_cast<milliseconds>(dur).count(); |
nuclear@38 | 19 } |
nuclear@69 | 20 #else |
nuclear@69 | 21 #include <Windows.h> |
nuclear@69 | 22 |
nuclear@69 | 23 unsigned long get_time_msec(void) |
nuclear@69 | 24 { |
nuclear@69 | 25 return GetTickCount(); |
nuclear@69 | 26 } |
nuclear@69 | 27 #endif |