22 lines
366 B
C++
22 lines
366 B
C++
#include "counter.h"
|
|
#include <sys/time.h>
|
|
#include <iostream>
|
|
#include <cstddef>
|
|
|
|
Counter::Counter()
|
|
{
|
|
|
|
}
|
|
|
|
void Counter::start(){
|
|
gettimeofday(&startTime, NULL);
|
|
}
|
|
|
|
long Counter::getTime(){
|
|
gettimeofday(&endTime, NULL);
|
|
long back = (endTime.tv_usec-startTime.tv_usec)/1000+(endTime.tv_sec-startTime.tv_sec)*1000;
|
|
this->start();
|
|
return back;
|
|
|
|
}
|