diff --git a/src/misc/timer.cpp b/src/misc/timer.cpp index e3239eb7..49900513 100644 --- a/src/misc/timer.cpp +++ b/src/misc/timer.cpp @@ -127,6 +127,12 @@ void Timer::run() work->processing = false; if(work->period > 0.0 && alive && !work->cancelled) { + if(waitfor <= -work->period) { + // Periodic timer phase has fallen behind by at least one full period. + // Could be due to previous slow jobs, or a system time jump forward. + // Reset the phase. + work->timeToRun = now = epicsTime::getCurrent(); + } work->timeToRun += work->period; addElement(work); }