MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ get_frame_lag()

uint64_t MayaFlux::Vruta::FrameClock::get_frame_lag ( ) const

Get how many frames behind we are (if any)

Returns
Number of frames we're running behind, or 0 if on time

Definition at line 107 of file Clock.cpp.

108{
109 auto now = std::chrono::steady_clock::now();
110
111 if (now <= m_next_frame_time) {
112 return 0;
113 }
114
115 auto elapsed = now - m_next_frame_time;
116 auto frames_behind = elapsed / m_frame_duration;
117 return static_cast<uint64_t>(frames_behind);
118}
std::chrono::nanoseconds m_frame_duration
Definition Clock.hpp:276
std::chrono::steady_clock::time_point m_next_frame_time
Definition Clock.hpp:284

References m_frame_duration, and m_next_frame_time.