MCPcopy Create free account
hub / github.com/MagicMirrorOrg/MagicMirror / delayCalculator

Function delayCalculator

defaultmodules/clock/clock.js:50–58  ·  view source on GitHub ↗
(reducedSeconds)

Source from the content-addressed store, hash-verified

48
49 // Calculate how many ms should pass until next update depending on if seconds is displayed or not
50 const delayCalculator = (reducedSeconds) => {
51 const EXTRA_DELAY = 50; // Deliberate imperceptible delay to prevent off-by-one timekeeping errors
52
53 if (this.config.displaySeconds) {
54 return 1000 - moment().milliseconds() + EXTRA_DELAY;
55 } else {
56 return (60 - reducedSeconds) * 1000 - moment().milliseconds() + EXTRA_DELAY;
57 }
58 };
59
60 // A recursive timeout function instead of interval to avoid drifting
61 const notificationTimer = () => {

Callers 2

notificationTimerFunction · 0.85
startFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected