Correct time for your web apps
View the Project on GitHub mikedamm/ntpjs
Your users computers may have clocks that are not set correctly. ntp.js solves this problem by contacting a known good source of time and calculating the offset from the local machine. This value can then be used to adjust any calculations done based on the current date or time.
The easiest (and recommended, see below) way to use ntp.js for your site or web app is to simply link to the hosted version.
<script src="https://use.ntpjs.org/ntp.js" async defer></script>
The server side code will be open sourced soon, so you can host the time server yourself. However, please use the public instance if possible. The client side JavaScript code sends the computers local time to the server, allowing statistics to be collected on exactly how inaccurate users clocks are. If you run a high traffic website, please email mike at damm dot com about dedicated server instances at no charge.
Requests for the JavaScript code and time updates are served by a highly distributed network of servers worldwide. Full details can be seen here.
Both the JavaScript and time response are served over SSL only. It should be fine for things like signing API requests, but please don't try to do crypto in the browser.
The "correct" time is based on the consensus of