Skip to content

Instantly share code, notes, and snippets.

@jtacoma
Last active August 29, 2015 14:01
Show Gist options
  • Save jtacoma/1cd227e2fc5f248c4feb to your computer and use it in GitHub Desktop.
Save jtacoma/1cd227e2fc5f248c4feb to your computer and use it in GitHub Desktop.
libswe demo
<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