dungeon_crawler

annotate prototype/src/timer.cc @ 61:4472ef41a209

forgot an extra mrt uniform in deferred_omni.p.glsl
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 25 Sep 2012 06:37:56 +0300
parents
children 45172d087ebe
rev   line source
nuclear@38 1 #include <chrono>
nuclear@38 2 #include "timer.h"
nuclear@38 3
nuclear@38 4 using namespace std::chrono;
nuclear@38 5
nuclear@38 6 static bool timer_initialized;
nuclear@38 7 static time_point<steady_clock> start_time;
nuclear@38 8
nuclear@38 9 unsigned long get_time_msec(void)
nuclear@38 10 {
nuclear@38 11 if(!timer_initialized) {
nuclear@38 12 start_time = steady_clock::now();
nuclear@38 13 timer_initialized = true;
nuclear@38 14 }
nuclear@38 15
nuclear@38 16 auto dur = steady_clock::now() - start_time;
nuclear@38 17 return duration_cast<milliseconds>(dur).count();
nuclear@38 18 }