1#include "webasm_timebase.hpp"
9std::chrono::system_clock::time_point g_start_time;
14 g_start_time = std::chrono::system_clock::now();
21 const auto now = std::chrono::system_clock::now();
23 std::chrono::duration_cast<std::chrono::microseconds>(now - g_start_time).count();
29 const auto now = std::chrono::system_clock::now();
31 std::chrono::duration_cast<std::chrono::milliseconds>(now - g_start_time).count();
32 return MillisecondTimestamp(
static_cast<uint32_t
>(ms));
微秒时间戳 / 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.
WebAsmTimebase()
构造函数 / Constructor