diff options
| author | Nicolas James <nj3ahxac@gmail.com> | 2026-03-12 20:42:37 +1100 |
|---|---|---|
| committer | Nicolas James <nj3ahxac@gmail.com> | 2026-03-12 20:42:37 +1100 |
| commit | 8ea01a571be073be00f8a77150f3d62ef5600b52 (patch) | |
| tree | ab4e262cff0d591e1145e4986f2d635527f63163 /src/device_context.hh | |
| parent | f16c927ab9083ac4d0ce38ec3b62ca8677055b90 (diff) | |
Fix potential clock domain mismatch when using chrono::now()
Diffstat (limited to 'src/device_context.hh')
| -rw-r--r-- | src/device_context.hh | 7 |
1 files changed, 7 insertions, 0 deletions
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 @@ -46,6 +46,13 @@ struct DeviceContext final : public Context { ~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; }; |
