git-subtree-dir: third_party/unordered_dense git-subtree-split: 231e48c9426bd21c273669e5fdcd042c146975cf
18 lines
333 B
C++
18 lines
333 B
C++
#include "periodic.h"
|
|
|
|
namespace ui {
|
|
|
|
periodic::periodic(std::chrono::steady_clock::duration interval)
|
|
: m_interval(interval) {}
|
|
|
|
periodic::operator bool() {
|
|
auto now = std::chrono::steady_clock::now();
|
|
if (now < m_next) {
|
|
return false;
|
|
}
|
|
m_next = now + m_interval;
|
|
return true;
|
|
}
|
|
|
|
} // namespace ui
|