nCine::TimeStamp class

Wraps a clock counter value representing a point in time or a duration.

Stores a raw counter value obtained from the system Clock. The same type is used both for absolute time points (e.g. now()) and for durations (e.g. the result of subtracting two time stamps). Conversion methods are provided to read the stored value, or the time elapsed since it, in seconds, milliseconds, microseconds or nanoseconds.

Public static functions

static auto now() -> TimeStamp
Returns a new time stamp initialized to the current clock value.

Constructors, destructors, conversion operators

TimeStamp()

Public functions

auto operator>(const TimeStamp& other) const -> bool
auto operator<(const TimeStamp& other) const -> bool
auto operator+=(const TimeStamp& other) -> TimeStamp&
auto operator-=(const TimeStamp& other) -> TimeStamp&
auto operator+(const TimeStamp& other) const -> TimeStamp
auto operator-(const TimeStamp& other) const -> TimeStamp
auto timeSince() const -> TimeStamp
Returns a new time stamp holding the duration elapsed since this one.
auto secondsSince() const -> float
Returns the time elapsed since this time stamp, in seconds.
auto millisecondsSince() const -> float
Returns the time elapsed since this time stamp, in milliseconds.
auto microsecondsSince() const -> float
Returns the time elapsed since this time stamp, in microseconds.
auto nanosecondsSince() const -> float
Returns the time elapsed since this time stamp, in nanoseconds.
auto ticks() const -> std::uint64_t
Returns the raw counter value in ticks.
auto seconds() const -> float
Returns the stored counter value as seconds.
auto milliseconds() const -> float
Returns the stored counter value as milliseconds.
auto microseconds() const -> float
Returns the stored counter value as microseconds.
auto nanoseconds() const -> float
Returns the stored counter value as nanoseconds.