{"id":5279,"date":"2021-09-09T19:27:04","date_gmt":"2021-09-09T11:27:04","guid":{"rendered":"https:\/\/www.xttblog.com\/?p=5279"},"modified":"2021-09-09T19:27:04","modified_gmt":"2021-09-09T11:27:04","slug":"%e6%8a%9b%e5%bc%83%e6%80%a7%e8%83%bd%e4%b8%8d%e4%bd%b3%e7%9a%84system-currenttimemillis%ef%bc%8c%e6%89%8b%e6%92%b8%e4%b8%80%e4%b8%aa%e4%bd%8e%e5%bc%80%e9%94%80%e8%8e%b7%e5%8f%96%e6%97%b6%e9%97%b4","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=5279","title":{"rendered":"\u629b\u5f03\u6027\u80fd\u4e0d\u4f73\u7684System.currentTimeMillis()\uff0c\u624b\u64b8\u4e00\u4e2a\u4f4e\u5f00\u9500\u83b7\u53d6\u65f6\u95f4\u6233\u5de5\u5177"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u5927\u5bb6\u597d\uff0c\u6211\u662f\u4e1a\u4f59\u8349\uff0c\u8fd9\u662f\u6211\u7684\u7b2c 447 \u7bc7\u539f\u521b\uff01<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f60\u6216\u8bb8\u542c\u8bf4\u8fc7\uff0c\u5728 Java \u4e2d\u8c03\u7528 System.currentTimeMillis() \u4f1a\u6709\u4e00\u4e9b\u6027\u80fd\u5f00\u9500\uff0c\u5728\u67d0\u4e9b\u573a\u666f\u4e0b\uff0cSystem.nanoTime() \u66f4\u5177\u4f18\u52bf\uff01<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6bd4\u5982\uff0c\u6d4b\u8bd5\u65b9\u6cd5\u7684\u8017\u65f6\u65f6\u95f4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public void save(){\n    long start = System.currentTimeMillis();\n    \/\/ doSomething() ...\n    System.out.println(System.currentTimeMillis() - start);\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u91cc\u5efa\u8bae\u4f60<code>System.currentTimeMillis()<\/code>\u6539\u4e3a<code>System.nanoTime()<\/code>\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public void save(){\n    long start = System.nanoTime();\n    \/\/ doSomething() ...\n    System.out.println(System.nanoTime() - start);\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u539f\u56e0\u6211\u4eec\u4e0b\u9762\u6162\u6162\u5c55\u5f00\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6628\u5929\u7fa4\u91cc\u8fd8\u6709\u4eba\u8bf4\uff0c\u53ef\u4ee5\u4f7f\u7528 StopWatch\u3002\u5c82\u4e0d\u77e5\uff0cStopWatch \u80cc\u540e\u4e5f\u662f<code>System.currentTimeMillis()<\/code>\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public void save(){\n    StopWatch stopWatch = new StopWatch();\n    stopWatch.start();\n    \/\/ doSomething() ...\n    stopWatch.stop();\n    System.out.println(stopWatch.prettyPrint());\n}<\/code><\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/xmt1139057136\/xttblog\/2021\/09\/java-currentTimeMillis.png\" alt=\"StopWatch\u5e95\u5c42\u65f6\u95f4\u83b7\u53d6\" \/><figcaption>StopWatch\u5e95\u5c42\u65f6\u95f4\u83b7\u53d6<\/figcaption><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">System.currentTimeMillis() \u7684\u7f3a\u70b9<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>System.currentTimeMillis()<\/code>\u8fd4\u56de\u7684\u662f\u6beb\u79d2\u6570\uff0c<code>System.nanoTime()<\/code>\u8fd4\u56de\u7684\u662f\u7eb3\u79d2\u6570\u3002\u5982\u679c\u65b9\u6cd5\u8dd1\u7684\u6bd4\u8f83\u5feb\uff0c\u6beb\u79d2\u7684\u6d4b\u8bd5\u5c31\u66f4\u4e0d\u51c6\u786e\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1000 \u76ae\u79d2 = 1\u7eb3\u79d2 \n1000000 \u76ae\u79d2 = 1\u5fae\u79d2 \n1000000000 \u76ae\u79d2 = 1\u6beb\u79d2 \n1000000000000 \u76ae\u79d2 = 1\u79d2\n\n1s = 1000 ms \u6beb\u79d2\n1ms = 1000000 ns \u7eb3\u79d2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u66f4\u4f55\u51b5\uff0c<code>currentTimeMillis<\/code>\u4f9d\u8d56\u5e95\u5c42\u64cd\u4f5c\u7cfb\u7edf\uff0c<code>nanoTime<\/code>\u5219\u662f\u6709 JVM \u7ef4\u62a4\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c55\u5f00\u6765\u8bf4\u5c31\u662f\uff0c\u6211\u4eec\u5728 Java \u4e2d\u83b7\u53d6\u65f6\u95f4\u6233\u7684\u65b9\u6cd5\u662f<code>System.currentTimeMillis()<\/code>\u8fd4\u56de\u7684\u662f\u6beb\u79d2\u7ea7\u7684\u65f6\u95f4\u6233\u3002\u67e5\u770b\u6e90\u7801\u6ce8\u91ca\uff0c\u5199\u7684\u6bd4\u8f83\u6e05\u695a\uff0c\u867d\u7136\u8be5\u65b9\u6cd5\u8fd4\u56de\u7684\u662f\u6beb\u79d2\u7ea7\u7684\u65f6\u95f4\u6233\uff0c\u4f46\u7cbe\u5ea6\u53d6\u51b3\u4e8e\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5f88\u591a\u64cd\u4f5c\u7cfb\u7edf\u8fd4\u56de\u7684\u7cbe\u5ea6\u662f 10 \u6beb\u79d2\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/**\n* Returns the current time in milliseconds.  Note that\n* while the unit of time of the return value is a millisecond,\n* the granularity of the value depends on the underlying\n* operating system and may be larger.  For example, many\n* operating systems measure time in units of tens of\n* milliseconds.\n*\n* &lt;p&gt; See the description of the class &lt;code&gt;Date&lt;\/code&gt; for\n* a discussion of slight discrepancies that may arise between\n* \"computer time\" and coordinated universal time (UTC).\n*\n* @return  the difference, measured in milliseconds, between\n*          the current time and midnight, January 1, 1970 UTC.\n* @see     java.util.Date\n*\/\npublic static native long currentTimeMillis();<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5 HotSpot \u6e90\u7801\u4e3a\u4f8b\uff0c\u6e90\u7801\u5728 hotspot\/src\/os\/linux\/vm\/os_linux.cpp \u6587\u4ef6\u4e2d\uff0c\u6709\u4e00\u4e2a<code>javaTimeMillis()<\/code>\u65b9\u6cd5\uff0c\u8fd9\u5c31\u662f<code>System.currentTimeMillis()<\/code>\u7684 native \u5b9e\u73b0\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>jlong os::javaTimeMillis() {\n  timeval time;\n  int status = gettimeofday(&amp;time, NULL);\n  assert(status != -1, \"linux error\");\n  return jlong(time.tv_sec) * 1000  +  jlong(time.tv_usec \/ 1000);\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u662f C++ \u5199\u7684\uff0c\u6211\u4e5f\u770b\u4e0d\u61c2\u3002\u6211\u4eec\u76f4\u63a5\u62ff\u8001\u5916\u7684\u7814\u7a76\u6765\u5b66\u4e60\uff1a<code>http:\/\/pzemtsov.github.io\/2017\/07\/23\/the-slow-currenttimemillis.html<\/code>\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u603b\u7ed3\u8d77\u6765\u539f\u56e0\u662f<code>System.currentTimeMillis<\/code>\u8c03\u7528\u4e86<code>gettimeofday()<\/code>\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u8c03\u7528<code>gettimeofday()<\/code>\u9700\u8981\u4ece\u7528\u6237\u6001\u5207\u6362\u5230\u5185\u6838\u6001\uff1b<\/li><li><code>gettimeofday()<\/code>\u7684\u8868\u73b0\u53d7<code>Linux<\/code>\u7cfb\u7edf\u7684\u8ba1\u65f6\u5668\uff08\u65f6\u949f\u6e90\uff09\u5f71\u54cd\uff0c\u5728 HPET \u8ba1\u65f6\u5668\u4e0b\u6027\u80fd\u5c24\u5176\u5dee\uff1b<\/li><li>\u7cfb\u7edf\u53ea\u6709\u4e00\u4e2a\u5168\u5c40\u65f6\u949f\u6e90\uff0c\u9ad8\u5e76\u53d1\u6216\u9891\u7e41\u8bbf\u95ee\u4f1a\u9020\u6210\u4e25\u91cd\u7684\u4e89\u7528\u3002<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u6d4b\u8bd5\u4e00\u4e0b<code>System.currentTimeMillis()<\/code>\u5728\u4e0d\u540c\u7ebf\u7a0b\u4e0b\u7684\u6027\u80fd\uff0c\u8fd9\u91cc\u4f7f\u7528\u4e2d\u95f4\u4ef6\u5e38\u7528\u7684<code>JHM<\/code>\u6765\u6d4b\u8bd5\uff0c\u6d4b\u8bd5 1 \u5230 128 \u7ebf\u7a0b\u4e0b\u83b7\u53d6 1000 \u4e07\u6b21\u65f6\u95f4\u6233\u9700\u8981\u7684\u65f6\u95f4\u5206\u522b\u662f\u591a\u5c11\uff0c\u8fd9\u91cc\u7ed9\u51fa\u5728\u6211\u7684\u7535\u8111\u4e0a\u7684\u6d4b\u8bd5\u6570\u636e\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/xmt1139057136\/xttblog\/2021\/09\/java-jmh2.png\" alt=\"System.currentTimeMillis()\u6027\u80fd\u6d4b\u8bd5\" \/><figcaption>System.currentTimeMillis()\u6027\u80fd\u6d4b\u8bd5<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd8\u6709\u4e00\u4e2a\u95ee\u9898\u5c31\u662f\uff0ccurrentTimeMillis \u83b7\u53d6\u7684\u662f\u7cfb\u7edf\u65f6\u95f4\u6e90\u3002\u56e0\u6b64\uff0c\u7cfb\u7edf\u65f6\u95f4\u53d8\u66f4\uff0c\u6216\u8005\u7cfb\u7edf\u81ea\u52a8\u8fdb\u884c\u4e86\u65f6\u95f4\u540c\u6b65\uff0c\u8ba1\u7b97\u4e24\u6b21\u83b7\u53d6\u7684\u5dee\u503c\uff0c\u53ef\u80fd\u662f\u8d1f\u6570\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u53e6\u5916<code>System.currentTimeMillis()<\/code>\u8fd4\u56de\u81ea\u7eaa\u5143(\u5373\u81ea 1970 \u5e74 1 \u6708 1 \u65e5 UTC \u5348\u591c\u4ee5\u6765\u7684\u6beb\u79d2\u6570)\u3002\u5982\u679c\u4f60\u7684\u7cfb\u7edf\u8bbe\u7f6e\u7684\u65f6\u95f4\u5c0f\u4e8e\u8fd9\u4e2a\u65f6\u95f4\uff0c\u90a3\u4e48 currentTimeMillis \u7684\u53d6\u503c\u4e5f\u53ef\u80fd\u662f\u8d1f\u6570\u3002\u5f53\u7136\u51e0\u4e4e\u6ca1\u4eba\u4f1a\u8fd9\u4e48\u8bbe\u7f6e\u65f6\u95f4\uff0c\u9664\u975e\u662f\u9ed1\u5ba2\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/xmt1139057136\/xttblog\/2021\/09\/jmh3.png\" alt=\"\u8bbe\u7f6e\u7cfb\u7edf\u65f6\u95f4\" \/><figcaption>\u8bbe\u7f6e\u7cfb\u7edf\u65f6\u95f4<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c0f\u603b\u7ed3\uff1a\u4f7f\u7528<code>System.currentTimeMillis()<\/code>\u8981\u6ce8\u610f\u7cbe\u5ea6\u3001\u6027\u80fd\u5f00\u9500\u3001\u65f6\u95f4\u540c\u6b65\u5f71\u54cd\u51c6\u786e\u6027\u3001\u65f6\u95f4\u4e0d\u5b89\u5168\u53ef\u80fd\u662f\u8d1f\u6570\u3001\u9ad8\u5e76\u53d1\u573a\u666f\u968f\u673a\u6570\u4e0d\u5747\u8861\u7b49\u95ee\u9898\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">System.nanoTime() \u7684\u7f3a\u70b9<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>System.nanoTime()<\/code>\u662f JDK 1.5 \u624d\u63a8\u51fa\u7684\uff0c\u56e0\u6b64 1.5 \u4e4b\u524d\u7684\u529e\u6cd5\u65e0\u6cd5\u4f7f\u7528\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7b2c\u4e8c\uff0c\u6e90\u7801\u6ce8\u91ca\u4e2d\u63cf\u8ff0\u5b83\u662f\u5b89\u5168\u7684\u3002\u4f46\u5728\u8001\u5916\u7684\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u53d1\u73b0\uff0c\u5b83\u6709\u65f6\u5019\u4e5f\u4e0d\u5b89\u5168\uff0c\u8fd4\u56de\u7684\u4e5f\u53ef\u80fd\u662f\u8d1f\u6570\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u53e6\u5916\u5b98\u65b9\u5efa\u8bae\uff0c\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u6d4b\u91cf elapsed time\uff0c\u4e0d\u80fd\u7528\u6765\u5f53\u4f5c wall-clock time \u6216 system time\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>\u275d<\/strong><\/p><p>This method can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time.\u275e<\/p><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">\u7f51\u4e0a\u8fd8\u66b4\u9732\u51fa\uff0c\u591a\u6838\u5904\u7406\u5668\u4e0d\u540c\u6838\u5fc3\u7684\u542f\u52a8\u65f6\u95f4\u53ef\u80fd\u4e0d\u5b8c\u5168\u4e00\u81f4\uff0c\u8fd9\u6837\u53ef\u80fd\u4f1a\u9020\u6210<code>System.nanoTime()<\/code>\u8ba1\u65f6\u9519\u8bef\u3002\u53c2\u8003\uff1a<code>https:\/\/stackoverflow.com\/questions\/510462\/is-system-nanotime-completely-useless<\/code>\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u624b\u64b8\u4e00\u4e2a currentTimeMillis<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5148\u5b9a\u4e49\u4e00\u4e2a\u5de5\u5177\u7c7b\uff1aTimeUtil\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n\/**\n * \u5f31\u7cbe\u5ea6\u7684\u8ba1\u65f6\u5668\uff0c\u8003\u8651\u6027\u80fd\u4e0d\u4f7f\u7528\u540c\u6b65\u7b56\u7565\u3002\n *\/\npublic class TimeUtil {\n    private static long CURRENT_TIME = System.currentTimeMillis();\n\n    public static final long currentTimeMillis() {\n        return CURRENT_TIME;\n    }\n\n    public static final void update() {\n        CURRENT_TIME = System.currentTimeMillis();\n    }\n\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u7136\u540e\u8d77\u4e00\u4e2a\u5b9a\u65f6\u5668\uff0c\u5b9a\u65f6\u66f4\u65b0\u7ef4\u62a4\u65f6\u95f4\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import java.util.Timer;\nimport java.util.TimerTask;\n\npublic class TimerServer {\n    private static final TimerServer INSTANCE = new TimerServer();\n    private final Timer timer;\n    \n    private TimerServer(){\n        timer = new Timer(\"\u4e1a\u4f59\u8349Timer\", true);\n        timer.schedule(updateTime(), 0L, 20L);\n    }\n\n    \/\/ \u7cfb\u7edf\u65f6\u95f4\u5b9a\u65f6\u66f4\u65b0\u4efb\u52a1\n    private TimerTask updateTime() {\n        return new TimerTask() {\n            @Override\n            public void run() {\n                TimeUtil.update();\n            }\n        };\n    }\n\n    public static final TimerServer getInstance() {\n        return INSTANCE;\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6216\u8005\u76f4\u63a5\u7528\u4e00\u4e2a TimeUtil \u7c7b\u641e\u5b9a\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public final class TimeUtil {\n\n    private static volatile long currentTimeMillis;\n\n    static {\n        currentTimeMillis = System.currentTimeMillis();\n        Thread daemon = new Thread(new Runnable() {\n            @Override\n            public void run() {\n                while (true) {\n                    currentTimeMillis = System.currentTimeMillis();\n                    try {\n                        TimeUnit.MILLISECONDS.sleep(1);\n                    } catch (Throwable e) {\n\n                    }\n                }\n            }\n        });\n        daemon.setDaemon(true);\n        daemon.setName(\"\u4e1a\u4f59\u8349-time-tick-thread\");\n        daemon.start();\n    }\n\n    public static long currentTimeMillis() {\n        return currentTimeMillis;\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u6837\u505a\u7684\u597d\u5904\u5c31\u662f\uff0c\u5728\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\uff0c\u5bf9\u65f6\u95f4\u8981\u6c42\u8f83\u9ad8\u7684\u573a\u666f\uff0c\u5219\u53ef\u4ee5\u81ea\u5df1\u7ef4\u62a4\u7cfb\u7edf\u65f6\u949f\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7ecf\u8fc7 JMH \u6d4b\u8bd5\u5bf9\u6bd4(\u6d4b\u8bd5\u4ee3\u7801\u53ef\u4ee5\u52a0\u6211\u5fae\u4fe1\uff1acodedq\uff0c\u514d\u8d39\u83b7\u53d6)\uff0c\u6211\u4eec\u624b\u64b8\u7684 TimeUtil \u5728 1-128 \u7ebf\u7a0b\u4e0b\u7684\u6027\u80fd\u8868\u73b0\u975e\u5e38\u5f3a\u52b2\uff0c\u6bd4\u7cfb\u7edf\u81ea\u5e26\u7684<code>System.currentTimeMillis()<\/code>\u9ad8\u51fa\u8fd1 876 \u500d\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/xmt1139057136\/xttblog\/2021\/09\/java-jmh1.png\" alt=\"\u4f4e\u5f00\u9500\u83b7\u53d6\u65f6\u95f4\u6233\" \/><figcaption>\u4f4e\u5f00\u9500\u83b7\u53d6\u65f6\u95f4\u6233<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u6bd4\u5982\uff1a\u963f\u91cc\u7684 Sentinel\uff0cCobar\u7b49\u3002Twitter \u7684 Snowflake(\u5f88\u591a\u4eba\u5728\u5b9e\u73b0 Snowflake \u65f6\uff0c\u91c7\u7528\u4e86 System.currentTimeMillis())\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u603b\u7ed3<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u867d\u7136\u7f13\u5b58\u65f6\u95f4\u6233\u6027\u80fd\u80fd\u63d0\u5347\u5f88\u591a\uff0c\u4f46\u8fd9\u4e5f\u4ec5\u9650\u4e8e\u975e\u5e38\u9ad8\u7684\u5e76\u53d1\u7cfb\u7edf\u4e2d\uff0c\u4e00\u822c\u6bd4\u8f83\u9002\u7528\u4e8e\u9ad8\u5e76\u53d1\u7684\u4e2d\u95f4\u4ef6\uff0c\u5982\u679c\u4e00\u822c\u7684\u7cfb\u7edf\u6765\u505a\u8fd9\u4e2a\u4f18\u5316\uff0c\u6548\u679c\u5e76\u4e0d\u660e\u663e\u3002\u6027\u80fd\u4f18\u5316\u8fd8\u662f\u8981\u6293\u4f4f\u4e3b\u8981\u77db\u76fe\uff0c\u89e3\u51b3\u74f6\u9888\uff0c\u5207\u5fcc\u4e0d\u53ef\u8fc7\u5ea6\u4f18\u5316\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u53c2\u8003\u8d44\u6599<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><a rel=\"noreferrer noopener\" aria-label=\"https:\/\/en.wikipedia.org\/wiki\/High_Precision_Event_Timer\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\" href=\"https:\/\/en.wikipedia.org\/wiki\/High_Precision_Event_Timer\" target=\"_blank\">https:\/\/en.wikipedia.org\/wiki\/High_Precision_Event_Timer<\/a><\/li><li><a rel=\"noreferrer noopener\" aria-label=\"https:\/\/en.wikipedia.org\/wiki\/Time_Stamp_Counter\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\" href=\"https:\/\/en.wikipedia.org\/wiki\/Time_Stamp_Counter\" target=\"_blank\">https:\/\/en.wikipedia.org\/wiki\/Time_Stamp_Counter<\/a><\/li><li><a href=\"http:\/\/pzemtsov.github.io\/2017\/07\/23\/the-slow-currenttimemillis.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\">http:\/\/pzemtsov.github.io\/2017\/07\/23\/the-slow-currenttimemillis.html<\/a><\/li><li><a rel=\"noreferrer noopener\" aria-label=\"https:\/\/stackoverflow.com\/questions\/510462\/is-system-nanotime-completely-useless\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\" href=\"http:\/\/pzemtsov.github.io\/2017\/07\/23\/the-slow-currenttimemillis.html\" target=\"_blank\">https:\/\/stackoverflow.com\/questions\/510462\/is-system-nanotime-completely-useless<\/a><\/li><\/ul>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=5279\">\u629b\u5f03\u6027\u80fd\u4e0d\u4f73\u7684System.currentTimeMillis()\uff0c\u624b\u64b8\u4e00\u4e2a\u4f4e\u5f00\u9500\u83b7\u53d6\u65f6\u95f4\u6233\u5de5\u5177<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u5927\u5bb6\u597d\uff0c\u6211\u662f\u4e1a\u4f59\u8349\uff0c\u8fd9\u662f\u6211\u7684\u7b2c 447 \u7bc7\u539f\u521b\uff01 \u4f60\u6216\u8bb8\u542c\u8bf4\u8fc7\uff0c\u5728 Java \u4e2d\u8c03\u7528 System.curre [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[386,106,43,202,531],"class_list":["post-5279","post","type-post","status-publish","format-standard","hentry","category-java","tag-java","tag-106","tag-43","tag-locked","tag-531"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/5279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5279"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/5279\/revisions"}],"predecessor-version":[{"id":5280,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/5279\/revisions\/5280"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}