Skip to content

Instantly share code, notes, and snippets.

@diiq
Created April 30, 2015 22:52
Show Gist options
  • Save diiq/e391f75b9efd7a59c4e6 to your computer and use it in GitHub Desktop.
Save diiq/e391f75b9efd7a59c4e6 to your computer and use it in GitHub Desktop.
Minimal Julian Clock
<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