Created
July 2, 2020 05:21
-
-
Save matsub/35e4932c58cbcf87619136116199597c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<span></span> | |
<script> | |
const span = document.querySelector("span"); | |
function step(timestamp) { | |
const date = new Date(); | |
const d = { | |
h: date.getHours().toString().padStart(2, '0'), | |
m: date.getMinutes().toString().padStart(2, '0'), | |
s: date.getSeconds().toString().padStart(2, '0'), | |
ms: Math.floor(date.getMilliseconds() / 100), | |
} | |
span.textContent = `${d.h}:${d.m}:${d.s}.${d.ms}`; | |
window.requestAnimationFrame(step); | |
} | |
window.requestAnimationFrame(step); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment