1#include "linux_timebase.hpp"
7int64_t GetElapsedMicroseconds()
10 clock_gettime(CLOCK_MONOTONIC, &ts);
11 return static_cast<int64_t
>(ts.tv_sec - libxr_linux_start_time_spec.tv_sec) *
13 static_cast<int64_t
>(ts.tv_nsec - libxr_linux_start_time_spec.tv_nsec) / 1000LL;
19 (void)clock_gettime(CLOCK_MONOTONIC, &libxr_linux_start_time_spec);
31 return MillisecondTimestamp(
static_cast<uint32_t
>(GetElapsedMicroseconds() / 1000LL));
LinuxTimebase()
构造函数 / Constructor
微秒时间戳 / Microsecond timestamp
static void ConfigureWrapRange(uint64_t max_valid_us, uint32_t max_valid_ms) noexcept
配置时间戳回绕上界。 Configure the timestamp wraparound limits.
static void SetReady(bool ready=true) noexcept
设置时间基就绪状态。 Set the timebase ready flag.
static MicrosecondTimestamp GetMicroseconds()
获取当前时间的微秒级时间戳。 Gets the current timestamp in microseconds.
static MillisecondTimestamp GetMilliseconds()
获取当前时间的毫秒级时间戳。 Gets the current timestamp in milliseconds.