setclock(amount);
}
+function adjustclockfromstate()
+{
+ let amount = parseInt(state['clock_min']) * 60 + parseInt(state['clock_sec']);
+ let elapsed = time_elapsed_raw();
+ if (Math.abs(amount - elapsed) >= 2.0) {
+ setclock(amount);
+ }
+}
+
function setclocklimitfromstate()
{
let amount = parseInt(state['clock_limit_min']) * 60 + parseInt(state['clock_limit_sec']);
lowerthird_visible = false;
}
-function time_elapsed()
+function time_elapsed_raw()
{
let elapsed = (Date.now() - clock_origin) * 1e-3;
if (clock_elapsed + elapsed >= clock_limit) {
clock_running = false;
return clock_limit;
}
- return Math.floor(clock_elapsed + elapsed);
+ return clock_elapsed + elapsed;
+}
+
+function time_elapsed()
+{
+ return Math.floor(time_elapsed_raw());
}
function update_clock()