kick
|
00001 // 00002 // Created by morten on 18/05/14. 00003 // 00004 00005 #include "time.h" 00006 #include <chrono> 00007 #include <ctime> 00008 00009 using namespace std; 00010 using namespace std::chrono; 00011 00012 namespace kick { 00013 long Time::frame = 0; 00014 float Time::deltaTime = 0; 00015 float Time::total() { 00016 static time_point<system_clock> start = system_clock::now(); 00017 auto elapsed_seconds = duration_cast<std::chrono::microseconds>(system_clock::now()-start); 00018 return elapsed_seconds.count()*1.0e-6f; 00019 } 00020 00021 long Time::frameCount() { 00022 return frame; 00023 } 00024 00025 float Time::delta() { 00026 return deltaTime; 00027 } 00028 };