Colobot
|
Some useful cross-platform operations on timestamps. More...
#include <chrono>
Typedefs | |
using | TimeUtils::TimeStamp = std::chrono::time_point< std::chrono::high_resolution_clock > |
Enumerations | |
enum class | TimeUnit { SECONDS , MILLISECONDS , MICROSECONDS } |
Functions | |
TimeStamp | TimeUtils::Lerp (TimeStamp a, TimeStamp b, float t) |
Linearly interpolates between two timestamps. More... | |
float | TimeUtils::Diff (TimeStamp before, TimeStamp after, TimeUnit unit=TimeUnit::SECONDS) |
Returns a difference between two timestamps in given time unit. More... | |
long long | TimeUtils::ExactDiff (TimeStamp before, TimeStamp after) |
Returns the exact (in nanosecond units) difference between two timestamps. More... | |
Some useful cross-platform operations on timestamps.
TimeStamp TimeUtils::Lerp | ( | TimeStamp | a, |
TimeStamp | b, | ||
float | t | ||
) |
Linearly interpolates between two timestamps.
float TimeUtils::Diff | ( | TimeStamp | before, |
TimeStamp | after, | ||
TimeUnit | unit = TimeUnit::SECONDS |
||
) |
Returns a difference between two timestamps in given time unit.
The difference is after - before.
long long TimeUtils::ExactDiff | ( | TimeStamp | before, |
TimeStamp | after | ||
) |
Returns the exact (in nanosecond units) difference between two timestamps.
The difference is after - before.