/*** Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved. File: TimerHighRes.hpp Date: 2021-6-10 Author: Reece ***/ #pragma once namespace Aurora::Time { class TimerHighRes { public: TimerHighRes() { Start(); } void Start() { start_ = CurrentInternalClockNS(); } AuUInt64 End() { auto re = std::clamp(CurrentInternalClockNS() - start_, AuInt64(0), std::numeric_limits::max()); if (re == std::numeric_limits::max()) return 0; // ez overflow in subtract. get out of here in 2-3 branches return re; } private: AuUInt64 start_; }; }