Files
openpilot-evo/panda/drivers/windows/pandaJ2534DLL Test/Timer.cpp
T
Vehicle Researcher 6c702630ac Merge commit '9b8e11b10c8e13193eeb95c5f94ab4bf3f021980' as 'panda'
old-commit-hash: 14fb17e22fe4020a46b7be8ef486dddb5210ef08
2017-12-23 17:10:42 -08:00

21 lines
456 B
C++

#include "stdafx.h"
#include "Timer.h"
Timer::Timer()
{
reset();
}
// gets the time elapsed from construction.
unsigned long long /*milliseconds*/ Timer::getTimePassed(){
// 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();
}
void Timer::reset() {
start = std::chrono::time_point_cast<std::chrono::milliseconds>(clock::now());
}