Files
dofs/docs/core/time.md

1.6 KiB

core/time.h

Free functions

constexpr Time operator""_ns(unsigned long long v) noexcept { ... }

return Time::from_ns(static_cast<Time::rep>(v));

constexpr Time operator""_us(unsigned long long v) noexcept { ... }

return Time::from_us(static_cast<Time::rep>(v));

constexpr Time operator""_ms(unsigned long long v) noexcept { ... }

return Time::from_ms(static_cast<Time::rep>(v));

constexpr Time operator""_s (unsigned long long v) noexcept { ... }

return Time::from_s (static_cast<Time::rep>(v));

class Time — public interface

constexpr Time() : _nsec(0) { ... }

explicit constexpr Time(rep ns) : _nsec(ns) { ... }

static constexpr Time from_ns(rep ns) noexcept { ... }

return Time(ns);

static constexpr Time from_us(rep us) noexcept { ... }

return Time(us * 1000ULL);

static constexpr Time from_ms(rep ms) noexcept { ... }

return Time(ms * 1000ULL * 1000ULL);

static constexpr Time from_s (rep s ) noexcept { ... }

return Time(s * 1000ULL * 1000ULL * 1000ULL);

constexpr rep ns() const noexcept { ... }

constexpr rep count() const noexcept { ... }

static constexpr rep us_to_ns(rep us) noexcept { ... }

static constexpr rep ms_to_ns(rep ms) noexcept { ... }

return Time(a._nsec + b._nsec);

return Time(a._nsec * b._nsec);

return safe_sub(a, b);

if (a._nsec < b._nsec) { ... }

return Time(a._nsec - b._nsec);

constexpr Time unsafe_sub(Time t) const noexcept { ... }

return Time(this->_nsec - t._nsec);