Simple delay timer

Any help appreciated as I am debugging a project that needs to be deployed asap.

I am debugging webcam video freezes so I want to check the isFrameNew() method of videograbber, and log an error when the webcam freezes.
The problem is isFrameNew equals false quite often even with a properly running video signal. So I believe I need a small delay

Here is my code. How would I add a simple timer or delay so I am not logging false errors?

if (_video.isFrameNew()){
     //do nothing!
    //log error
     ofLogError () << "ofApp update NO NEW VIDEO FRAME!";

you just need to store the time at what you got the last frame:

uint64_t lastTime;
uint64_t maxTimeNoFrame;

maxTimeNoFrame = 120; // at 30fps this would be roughtly 4 frames

uint64_t now = ofGetElapsedTimeMillis();
    lastTime = now;
    if(lastTime>0 && now-lastTime>maxTimeNoFrame){
        // error

you probably want to make maxTimeNoFrame bigger

thanks Arturo!
A lot simpler than implementing a timer class
assume uint63_t maxTimeNoFrame;

is actually

uint64_t maxTimeNoFrame;
and I also need to declare

uint64_t now;

yes, i’ve just edited it