dungeon_crawler
diff prototype/src/timer.cc @ 38:862461b686f4
start work on particle systems
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 29 Aug 2012 03:22:36 +0300 |
parents | |
children | 45172d087ebe |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/prototype/src/timer.cc Wed Aug 29 03:22:36 2012 +0300 1.3 @@ -0,0 +1,18 @@ 1.4 +#include <chrono> 1.5 +#include "timer.h" 1.6 + 1.7 +using namespace std::chrono; 1.8 + 1.9 +static bool timer_initialized; 1.10 +static time_point<steady_clock> start_time; 1.11 + 1.12 +unsigned long get_time_msec(void) 1.13 +{ 1.14 + if(!timer_initialized) { 1.15 + start_time = steady_clock::now(); 1.16 + timer_initialized = true; 1.17 + } 1.18 + 1.19 + auto dur = steady_clock::now() - start_time; 1.20 + return duration_cast<milliseconds>(dur).count(); 1.21 +}