Does anyone know a good JSON time server?

I need to get the current time (from a trusted source) using JSON. The exact time is critical to my application, so I can’t rely on the device’s uptime, even if it’s just a second or two.

EDIT: I'm not so worried about "accuracy", but simply so that multiple devices running the application have the same time.

+4
source share
2 answers
function getTime(zone, success) { var url = 'http://json-time.appspot.com/time.json?tz=' + zone, ud = 'json' + (+new Date()); window[ud]= function(o){ success && success(new Date(o.datetime)); }; document.getElementsByTagName('head')[0].appendChild((function(){ var s = document.createElement('script'); s.type = 'text/javascript'; s.src = url + '&callback=' + ud; return s; })()); } getTime('GMT', function(time){ // This is where you do whatever you want with the time: alert(time); }); 

from here

+2
source

As of September 12, 2015, http://www.timeapi.org/utc/now.json seems to be working.

 {"dateString":"2015-09-12T23:15:56+01:00"} 

More information here http://www.timeapi.org . It was hosted on Heroku, and the source is located on Github .

+1
source

Source: https://habr.com/ru/post/1398856/


All Articles