diff --git a/Implementing-Power-Save,-aka-Idling-outside-of-ImGui.md b/Implementing-Power-Save,-aka-Idling-outside-of-ImGui.md index 94c2e73..f20b567 100644 --- a/Implementing-Power-Save,-aka-Idling-outside-of-ImGui.md +++ b/Implementing-Power-Save,-aka-Idling-outside-of-ImGui.md @@ -126,7 +126,7 @@ bool ShallIdleThisFrame_Emscripten(FpsIdling& ioIdling) } static double lastRefreshTime = 0.; - double now = Internal::ClockSeconds(); + double now = ClockSeconds(); bool shallIdleThisFrame = false; if (hasInputEvent) @@ -150,4 +150,17 @@ bool ShallIdleThisFrame_Emscripten(FpsIdling& ioIdling) } ``` +where ClockSeconds could be implemented for example like this: +```cpp +#include + +double ClockSeconds() +{ + static const auto start = std::chrono::steady_clock::now(); + auto now = std::chrono::steady_clock::now(); + std::chrono::duration elapsed = now - start; + return elapsed.count(); +} + +```