You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wubloader/thrimbletrimmer/clock.html

33 lines
847 B
HTML

<html>
<script>
delay = 10;
bustime = 1605290400;
function update() {
delay = parseInt(document.getElementById("Delay").value);
}
setInterval(function() {
var time = new Date().getTime() / 1000 - delay - bustime;
var minus = "";
if (time < 0) {
time = -time
minus = "-";
}
var hours = Math.trunc(time / 3600).toString();
var mins = Math.trunc((time % 3600) / 60).toString();
var secs = Math.trunc(time % 60).toString();
if (mins.length < 2) {mins = "0" + mins;}
if (secs.length < 2) {secs = "0" + secs;}
var formatted = minus + hours + ":" + mins + ":" + secs;
document.getElementById("Clock").value = formatted;
}, 1000);
</script>
<body>
<input type="text" id="Clock" disabled />
<br/>
Delay: <input type="text" id="Delay" value="10"/>
<input type="button" id="Update" onclick="update()" value="Update Delay"/>
</body>
</html>