mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-02-18 22:13:51 +08:00
version: lp-dp v0.9.5 for EON/C2 date: 2023-09-13T13:36:48 commit: 1d59b81c40b93f37d4a341c5d35b1c3cd293543d
24 lines
518 B
C++
24 lines
518 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
class RateKeeper {
|
|
public:
|
|
RateKeeper(const std::string &name, float rate, float print_delay_threshold = 0);
|
|
~RateKeeper() {}
|
|
bool keepTime();
|
|
bool monitorTime();
|
|
inline double frame() const { return frame_; }
|
|
inline double remaining() const { return remaining_; }
|
|
|
|
private:
|
|
double interval;
|
|
double next_frame_time;
|
|
double last_monitor_time;
|
|
double remaining_ = 0;
|
|
float print_delay_threshold = 0;
|
|
uint64_t frame_ = 0;
|
|
std::string name;
|
|
};
|