我知道各种 Windows 命令行功能,例如:
TIME
- 允许您获取和设置时钟时间
wmic os get localdatetime
- 返回本地日期时间
wmic os get lastbootuptime
- 以滴答为单位获取上次启动时间(我还没有找到获取滴答数的命令行)
当您执行以下操作时,JavaScript 使用什么来获取时间?
var d = new Date();
var time = d.getTime();
它是系统调用吗?如果是的话是哪一个?它的准确性如何?
最佳答案
这与 JS 有关,而不是特定操作系统:
The JavaScript Date object provides uniform behavior across platforms. The time value can be passed between systems to represent the same moment in time and if used to create a local date object, will reflect the local equivalent of the time.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
关于javascript - JavaScript的 `new Date().getTime()`在Windows中如何获取本地时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36242855/