2017-09-14 18:01:06 -07:00
|
|
|
#include "stdafx.h"
|
|
|
|
|
#include "Timer.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Timer::Timer()
|
|
|
|
|
{
|
2017-10-15 17:35:33 -07:00
|
|
|
reset();
|
2017-09-14 18:01:06 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// gets the time elapsed from construction.
|
2017-10-11 03:33:25 -07:00
|
|
|
unsigned long long /*milliseconds*/ Timer::getTimePassed(){
|
2017-09-14 18:01:06 -07:00
|
|
|
// get the new time
|
|
|
|
|
auto end = std::chrono::time_point_cast<std::chrono::milliseconds>(clock::now());
|
|
|
|
|
|
|
|
|
|
// return the difference of the times
|
|
|
|
|
return (end - start).count();
|
2017-10-15 17:35:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Timer::reset() {
|
|
|
|
|
start = std::chrono::time_point_cast<std::chrono::milliseconds>(clock::now());
|
2017-09-14 18:01:06 -07:00
|
|
|
}
|