ntp.js

Correct time for your web apps

View the Project on GitHub mikedamm/ntpjs

What is it?

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.

Using ntp.js

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>

Can I host the ntp.js server myself?

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.

Is the server fast/reliable?

Requests for the JavaScript code and time updates are served by a highly distributed network of servers worldwide. Full details can be seen here.

Is it safe/secure?

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.

Where do you get your time from?

The "correct" time is based on the consensus of

Who is responsible for this?

@mikedamm and @jfox85