I want to display the current time in HH:mm:ss format beside this I want to display spinner single glyph that cycles through [ '↑', '↗', '→', '↘', '↓', '↙', '←', '↖' ]. (i.e. HTML glyph characters: ↑, ↗, →, ↘, ↓, ↙, ←, and ↖) The spinner should be updated every 125ms and should show ↑ when the clock ticks to each new second.
So far I am able to display the current time using the following code
function checkTime(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}
function startTime() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
// add a zero in front of numbers<10
m = checkTime(m);
s = checkTime(s);
document.getElementById('time').innerHTML = h + ":" + m + ":" + s;
t = setTimeout(function() {
startTime()
}, 500);
}
startTime();
But I am not able to display spinner which moves every 125ms