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

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

问题描述

我正在使用微控制器,不想跟踪系统时钟的时间。我想发一个HTTP请求来从纪元(1970)获得当前时间(以毫秒为单位)。我已经知道如何形成所有请求,我只是找不到可以将这些数据返回给我的网址。谁提供这个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.

推荐答案

我有一个名为当前的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从epoch获取毫秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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