Last active
August 29, 2015 14:01
-
-
Save jtacoma/1cd227e2fc5f248c4feb to your computer and use it in GitHub Desktop.
libswe demo
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
<html> | |
<head> | |
<script src="https://github.com/jtacoma/libswe/releases/download/v2.00.00-1alpha0/libswe.js"></script> | |
</head> | |
<body> | |
<p> | |
The current time, as a Julian Day Number in Universal Time, as | |
calculated by the Swiss Ephemeris is: | |
</p> | |
<p> | |
<strong id="now"></strong> | |
</p> | |
<p> | |
<a onclick="javascript:refresh_swe_now();">Click here to re-calculate.</a> | |
</p> | |
</body> | |
<script> | |
function refresh_swe_now() { | |
var now = new Date(); | |
var jul_day_ut = swe.Module._swe_julday( | |
now.getUTCFullYear(), | |
now.getUTCMonth()+1, | |
now.getUTCDate(), | |
now.getUTCHours() + now.getUTCMinutes() / 60 + now.getUTCSeconds() / (60*60), | |
swe.Module.SE_GREG_CAL); | |
var now_div = document.getElementById("now"); | |
now_div.innerHTML = jul_day_ut; | |
}; | |
refresh_swe_now(); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment