Question

I have found certain online time servers that share accurate time when provided with proper time zones. For example:

  • time.windows.com
  • time.nist.gov
  • time-nw.nist.gov
  • time-a.nist.gov
  • time-b.nist.gov

are some time servers that are used by Windows to auto-update time over internet. I want to use these servers to determine the accurate time instead of local server time or client system time. I tried querying as : http://time.windows.com/?timezone=GMT+5:30 (get request) expecting to get current time in India but it said: Error : 403.

So, I would like to know , What's the right format to query such time server to get the time & date in response. Codes using any ne of html (get)(post), php, js, jquery is/are acceptable.

Thanks !

Was it helpful?

Solution

You should not do this from your application code. As you are pointing out there are "some time servers that are used by Windows to auto-update time over internet." So, use an appropriate client program/service to set your server's time on a regular bases. This way your server's clock will always be accurate to the microsecond level. Attempting to query a time-server on a per request bases (as your description suggests) is foolish and causes a great deal of unnecessary overhead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top