发现个有意思的事情,关于Java 的 System.currentTimeMillis()。

一直以为这个值在不同时区的机器上应该返回的结果都是一样的,结果发现在Android系统和Ubuntu服务器上的结果居然相差了10倍。

ubuntu: 1563340521712
android: 156334051401

查看了一下文档,注意最后的fox example:

Returns the current time in milliseconds. Note thatwhile the unit of time of the return value is a millisecond, the granularity of the value depends on the underlying operating system and may be larger. For example, many operating systems measure time in units of tens of milliseconds.

不知道以前的代码怎么样了,逃...
展开
评论