MayaFlux 1.0.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 111 of file Clock.cpp.

112{
113 auto now = std::chrono::steady_clock::now();
114
115 if (now <= m_next_frame_time) {
116 return 0;
117 }
118
119 auto elapsed = now - m_next_frame_time;
120 auto frames_behind = elapsed / m_frame_duration;
121 return static_cast<uint64_t>(frames_behind);
122}
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.