Created
April 30, 2015 22:52
-
-
Save diiq/e391f75b9efd7a59c4e6 to your computer and use it in GitHub Desktop.
Minimal Julian Clock
This file contains 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
<script type="text/javascript"> | |
function currentJulianDay() { | |
var epoch = 2440587.500000; // Jan. 1, 1970 00:00:00 UTC, Julian | |
var day = (new Date()).getTime() / 86400000 + epoch; | |
return day.toFixed(5); | |
} | |
function writeTime() { | |
document.getElementById("julian-clock").innerHTML = currentJulianDay(); | |
} | |
setInterval(writeTime, 1000); | |
</script> | |
<div id="julian-clock"></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment