JavaScript's getTime()返回“自 1970 年 1 月 1 日 00:00:00 UTC 以来的毫秒数”。
我可以相信这在不同的机器上是相似的吗?我不需要它精确到毫秒,只需精确到几秒。
或者我需要使用外部时间服务 API,as in this question ?
JavaScript 从哪里获取当前时间 - 它取决于机器的时钟吗?
最佳答案
Can I rely on this being similar across different machines?
没有。
Where does JavaScript get the current time from
运行此 javascript 的系统日期时间。
Or do I need to use an external time service API, as in this question?
您可以使用服务器的时间并将其发送给客户端。
关于javascript - 在不同系统之间比较 JavaScript 的 getTime() 是否安全?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8342506/