通过 HTTP 从纪元获取毫秒数 [英] Get milliseconds from epoch via HTTP

查看:26
本文介绍了通过 HTTP 从纪元获取毫秒数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究微控制器,不想使用系统时钟跟踪时间.我想发出一个 HTTP 请求以从纪元(1970 年)获取当前时间(以毫秒为单位).我已经知道如何形成所有请求,只是找不到可以将此数据返回给我的 url.谁将其作为 API 提供?我不想发出 https 请求.

I am working on a microcontroller and don't want to keep track of time with the system clock. I want to make an HTTP request to get the current time in milliseconds from the epoch (1970). I already know how to form all the requests, I just can't find a url that can return this data to me. Who offers this as an API? I don't want to make an https request.

推荐答案

我有一个名为 Current Millis 的站点,理论上是无限的带宽.我想我可以快速写一个 php,比如 www.currentmillis.com/api/millis-since-epoch.php.这对你好吗?

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

更新:这是无限带宽但不是无限资源..因为服务器无法维持对将时间解析为毫秒的服务的数百万个 HTTP 请求,该 URL 已停止使用..而是提供自纪元以来的分钟现在:http://currentmillis.com/time/minutes-since-unix-epoch.php(因为主机服务器可以在1分钟内缓存该值)

UPDATE: It was infinite bandwidth but not infinite resources.. Because the server can not hope to sustain millions of HTTP requests to a service that resolves time to the millisecond, that URL has been discontinued.. Instead minutes since epoch are offered now: http://currentmillis.com/time/minutes-since-unix-epoch.php (because within 1 minute the value can be cahced by the host server)

这篇关于通过 HTTP 从纪元获取毫秒数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆