Skip to content

Commit b2af3d0

Browse files
committed
moved make functions out of cycle timer
1 parent 5019b03 commit b2af3d0

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

include/oryx/chrono/cycle_timer.hpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,19 @@ class CycleTimer {
3030

3131
auto target_cycle_time() const -> Duration { return target_; }
3232

33-
static auto MakeAutoResetGuard(CycleTimer<Clock>& timer) {
34-
return ScopeExit{[&timer] { timer.Reset(); }};
35-
};
36-
37-
static auto MakeFrameRateTimer(int target_fps) { return CycleTimer<Clock>{Duration{1000 / target_fps}}; }
38-
3933
private:
4034
const Duration target_;
4135
details::StopwatchImpl<Clock> sw_{};
4236
};
4337

38+
template <class Clock>
39+
auto MakeScopedCycleTimerReset(CycleTimer<Clock>& timer) {
40+
return ScopeExit{[&timer] { timer.Reset(); }};
41+
}
42+
43+
template <class Clock>
44+
auto MakeFrameRateTimer(int target_fps) {
45+
return CycleTimer<Clock>{typename CycleTimer<Clock>::Duration{1000 / target_fps}};
46+
}
47+
4448
} // namespace oryx::chrono

0 commit comments

Comments
 (0)