dungeon_crawler
view prototype/src/timer.cc @ 66:6a471c87f9ca
- added visual studio project files
- changed some __func__ into __FUNCTION__ to compile on visual studio
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 07 Oct 2012 00:19:48 +0200 |
parents | |
children | 45172d087ebe |
line source
1 #include <chrono>
2 #include "timer.h"
4 using namespace std::chrono;
6 static bool timer_initialized;
7 static time_point<steady_clock> start_time;
9 unsigned long get_time_msec(void)
10 {
11 if(!timer_initialized) {
12 start_time = steady_clock::now();
13 timer_initialized = true;
14 }
16 auto dur = steady_clock::now() - start_time;
17 return duration_cast<milliseconds>(dur).count();
18 }