typedef renamed
This commit is contained in:
parent
70454b4640
commit
ef13249405
@ -8,8 +8,9 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
typedef uint32_t millis_t;
|
//! Don't use these for time points, type is not large enough for UNIX epoch.
|
||||||
typedef double seconds_t;
|
typedef uint32_t dur_millis_t;
|
||||||
|
typedef double dur_seconds_t;
|
||||||
|
|
||||||
class Clock {
|
class Clock {
|
||||||
public:
|
public:
|
||||||
|
@ -13,12 +13,12 @@ void Stopwatch::start() {
|
|||||||
Clock::getClock_timeval(&startTime);
|
Clock::getClock_timeval(&startTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
millis_t Stopwatch::stop() {
|
dur_millis_t Stopwatch::stop() {
|
||||||
stopInternal();
|
stopInternal();
|
||||||
return elapsedTime.tv_sec * 1000 + elapsedTime.tv_usec / 1000;
|
return elapsedTime.tv_sec * 1000 + elapsedTime.tv_usec / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
seconds_t Stopwatch::stopSeconds() {
|
dur_seconds_t Stopwatch::stopSeconds() {
|
||||||
stopInternal();
|
stopInternal();
|
||||||
return timevalOperations::toDouble(elapsedTime);
|
return timevalOperations::toDouble(elapsedTime);
|
||||||
}
|
}
|
||||||
|
@ -40,12 +40,12 @@ public:
|
|||||||
* Calculates the elapsed time since start and returns it
|
* Calculates the elapsed time since start and returns it
|
||||||
* @return elapsed time in milliseconds (rounded)
|
* @return elapsed time in milliseconds (rounded)
|
||||||
*/
|
*/
|
||||||
millis_t stop();
|
dur_millis_t stop();
|
||||||
/**
|
/**
|
||||||
* Calculates the elapsed time since start and returns it
|
* Calculates the elapsed time since start and returns it
|
||||||
* @return elapsed time in seconds (double precision)
|
* @return elapsed time in seconds (double precision)
|
||||||
*/
|
*/
|
||||||
seconds_t stopSeconds();
|
dur_seconds_t stopSeconds();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the elapsed times on the osstream, depending on internal display
|
* Displays the elapsed times on the osstream, depending on internal display
|
||||||
|
Loading…
x
Reference in New Issue
Block a user