In a previous post, I repeated a piece of code retrieved from the Internet that was intended to calculate the interval since the last frame when using CVDisplayLink. Unfortunately that code was actually incorrect, what it calculated was the frame rate.
I present the corrected code below in the hope that my answer will prove useful to others:
double frameRate = 1.0 / (outputTime->rateScalar * (double)outputTime->videoTimeScale / (double)outputTime->videoRefreshPeriod); static int64_t lastVideoTime = 0; double timeSinceLastUpdate = 0.0; if (lastVideoTime) { int64_t videoTimeDelta = outputTime->videoTime - lastVideoTime; timeSinceLastUpdate = outputTime->rateScalar * (double)videoTimeDelta / (double)outputTime->videoTimeScale; } lastVideoTime = outputTime->videoTime;