[ https://issues.apache.org/jira/browse/FLINK-4422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15885571#comment-15885571 ]
ASF GitHub Bot commented on FLINK-4422: --------------------------------------- Github user tzulitai commented on a diff in the pull request: https://github.com/apache/flink/pull/3420#discussion_r103181679 --- Diff: flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/KillerWatchDog.java --- @@ -42,12 +42,12 @@ @SuppressWarnings("deprecation") @Override public void run() { - final long deadline = System.currentTimeMillis() + timeout; + final long deadline = System.nanoTime() + timeout * 1_000_000L; long now; - while (toKill.isAlive() && (now = System.currentTimeMillis()) < deadline) { + while (toKill.isAlive() && (now = System.nanoTime()) < deadline) { try { - toKill.join(deadline - now); + toKill.join( ( deadline - now ) / 1_000_000L ); --- End diff -- nit: I don't think we usually have spaces after braces like this here. There isn't an agreed codestyle for this, but I think we can remove the spaces to be consistent with other parts of the code. Will fix will merging. > Convert all time interval measurements to System.nanoTime() > ----------------------------------------------------------- > > Key: FLINK-4422 > URL: https://issues.apache.org/jira/browse/FLINK-4422 > Project: Flink > Issue Type: Sub-task > Components: Core > Reporter: Stephan Ewen > Assignee: Jin Mingjian > Priority: Minor > > In contrast to {{System.currentTimeMillis()}}, {{System.nanoTime()}} is > monotonous. To measure delays and time intervals, {{System.nanoTime()}} is > hence reliable, while {{System.currentTimeMillis()}} is not. -- This message was sent by Atlassian JIRA (v6.3.15#6346)