Back to the notes

NIST runs the official US time server and you can query it

The National Institute of Standards and Technology maintains atomic clocks in Colorado and Maryland, then serves that time over the internet. The API is simpler than you think.

A round analogue wall clock with black hands and numerals
Ocean Ng / Unsplash Unsplash License

The National Institute of Standards and Technology runs the official US time service. Not a vague standard, an actual HTTP endpoint you can hit right now. Two atomic clock facilities. One in Boulder, Colorado. One in Gaithersburg, Maryland. They broadcast the time over shortwave radio and the internet. The web version is a JSON API that returns Unix milliseconds, timezone offsets, and daylight saving status. No authentication. No rate limit mentioned on the page. This is not a third-party NTP wrapper. This is the actual source. NIST maintains the caesium fountain clocks that define the second. The same organisation that publishes the cybersecurity framework and post-quantum cryptography standards also runs a free API for what time it is. The use case is narrow. If you need sub-millisecond precision, you use NTP or PTP, not HTTP. But for logging, scheduled tasks, or anything where “accurate to the nearest hundred milliseconds” is good enough, this works. No library. No daemon. One GET request. I checked the response headers. No CORS restrictions. You could call this from a browser. The page itself is a thin JavaScript client that polls the API every second and updates the DOM. View source and the whole implementation is forty lines. What surprised me is how un-advertised this is. No developer docs. No changelog. The page has been live for years and the HN thread has five upvotes. Either nobody needs this or everyone assumes it does not exist. I would use this for drift checks. Query it once an hour, compare to Date.now(), log when your server clock wanders past fifty milliseconds. Cheaper than running your own NTP monitor and more authoritative than a random public pool.


Source: National Institute of Standards and Technology | NIST | Official US Time

Back to all notes

Behind the notes

Vikrant
Sharma.

Artificial Intelligence Engineer intern at Voxon Photonics in Adelaide. Studying a Master of Information and Communications Technology at UniSC, with a focus on data, machine learning and security.

Meet the person behind the work