Get milliseconds from era through HTTP

I am working on a microcontroller and do not want to track the time with the system clock. I want to make an HTTP request to get the current time in milliseconds since the era (1970). I already know how to form all requests, I just can’t find a URL that can return this data to me. Who offers this as an API? I do not want to make an https request.

+3
source share
2 answers

I have a site called Current Millis and a theoretically infinite bandwidth. I think I can quickly write PHP, say www.currentmillis.com/api/millis-since-epoch.php. Is it ok for you?

: , . HTTP- , , URL- .. , : http ://currentmillis.com/time/minutes-since-unix-epoch.php ( 1 -)

+7

https://now.httpbin.org/ - JSON , , :

$ curl -s http://now.httpbin.org/
{"now": {"epoch": 1547752567.4569337, "slang_date": "today", "slang_time": "now", "iso8601": "2019-01-17T19:16:07.456934Z", "rfc2822": "Thu, 17 Jan 2019 19:16:07 GMT", "rfc3339": "2019-01-17T19:16:07.45Z"}, "urls": ["/", "/docs", "/when/:human-timestamp", "/parse/:machine-timestamp"]}

JSON , unix, jq - :

$ curl -s http://now.httpbin.org/ | jq
{
  "now": {
    "epoch": 1547752558.6447814,
    "slang_date": "today",
    "slang_time": "now",
    "iso8601": "2019-01-17T19:15:58.644781Z",
    "rfc2822": "Thu, 17 Jan 2019 19:15:58 GMT",
    "rfc3339": "2019-01-17T19:15:58.64Z"
  },
  "urls": [
    "/",
    "/docs",
    "/when/:human-timestamp",
    "/parse/:machine-timestamp"
  ]
}

$ curl -s http://now.httpbin.org/ | jq '.now.epoch'
1547752585.5284808
0

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


All Articles