From 8ea01a571be073be00f8a77150f3d62ef5600b52 Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Thu, 12 Mar 2026 20:42:37 +1100 Subject: Fix potential clock domain mismatch when using chrono::now() --- src/device_context.hh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/device_context.hh') diff --git a/src/device_context.hh b/src/device_context.hh index 18b89be..c76f376 100644 --- a/src/device_context.hh +++ b/src/device_context.hh @@ -45,6 +45,13 @@ struct DeviceContext final : public Context { Clock(const DeviceContext& device); ~Clock(); + public: + // WARNING: This *MUST* be used over std::chrono::steady_clock::now if + // you're planning on comparing it to a device's clock. If it isn't, the + // timestamps might from different domains and will be completely + // nonsensical. + static time_point_t now(); + public: void calibrate(); time_point_t ticks_to_time(const std::uint64_t& ticks) const; -- cgit v1.2.3