MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / FastForwardTo

Method FastForwardTo

plugins/schedule/macro-schedule.cpp:285–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285void MacroScheduleEntry::FastForwardTo(const QDateTime &now)
286{
287 timesTriggered = 0;
288 lastTriggered = QDateTime();
289
290 if (!startDateTime.isValid()) {
291 return;
292 }
293
294 if (!doesRepeat) {
295 // One-shot: count it as triggered if the start lies in the past.
296 if (startDateTime <= now) {
297 timesTriggered = 1;
298 lastTriggered = startDateTime;
299 }
300 return;
301 }
302
303 // Repeating: walk intervals from startDateTime and count each one
304 // that falls at or before 'now'.
305 QDateTime t = startDateTime;
306 while (t <= now) {
307 ++timesTriggered;
308 lastTriggered = t;
309 const QDateTime next = advanceFrom(t);
310 if (!next.isValid()) {
311 break;
312 }
313 t = next;
314 }
315}
316
317QString MacroScheduleEntry::GetRepeatDescription() const
318{

Callers 1

ApplyToEntryMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected