40 explicit CyclicTimer(std::chrono::microseconds period);
95 void setPeriod(std::chrono::microseconds period);
99 void* handle_ =
nullptr;
100 int64_t qpcFreq_ = 0;
101 int64_t periodTicks_ = 0;
110 void advanceOnePeriod() {
111 next_nsec_ += period_ns_;
112 if (next_nsec_ >= 1'000'000'000L) {
113 next_nsec_ -= 1'000'000'000L;
118 int64_t period_ns_ = 0;
119 int64_t next_sec_ = 0;
120 int64_t next_nsec_ = 0;
Precision cyclic timer for fixed-period loops.
Definition cyclic_timer.h:35
CyclicTimer & operator=(const CyclicTimer &)=delete
Copy assignment is deleted — see copy constructor.
CyclicTimer(const CyclicTimer &)=delete
Copying is deleted — each instance owns its own deadline state and, on Windows, an OS timer handle th...
~CyclicTimer()
Destroys the timer. On Windows, cancels and closes the OS timer handle. On Linux, no OS resource is h...
Definition cyclic_timer_windows.cc:36
void setPeriod(std::chrono::microseconds period)
Changes the cycle period and re-anchors the deadline grid to now.
Definition cyclic_timer_linux.cc:16
uint64_t waitForNextCycle()
Blocks until the next cycle deadline, then returns.
Definition cyclic_timer_linux.cc:24
Definition http_server.h:25