You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2020/05/31 09:27:16 UTC

[GitHub] [incubator-iotdb] Alima777 commented on a change in pull request #1290: [IOTDB-718]Fix wrong time precision of NOW()

Alima777 commented on a change in pull request #1290:
URL: https://github.com/apache/incubator-iotdb/pull/1290#discussion_r432927503



##########
File path: server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
##########
@@ -1475,7 +1475,15 @@ long parseTimeFormat(String timestampStr) throws SQLParserException {
       throw new SQLParserException("input timestamp cannot be empty");
     }
     if (timestampStr.equalsIgnoreCase(SQLConstant.NOW_FUNC)) {
-      return System.currentTimeMillis();
+      String timePrecision = IoTDBDescriptor.getInstance().getConfig().getTimestampPrecision();
+      switch (timePrecision) {
+        case "ns":
+          return System.currentTimeMillis() * 1000_000L;

Review comment:
       I agree with @qiaojialin and @jixuan1989 both.  System.nanoTime can't get the current time correctly, while the precision of *1000 or *1000_100 is unchanged actually. We need to rethink about the implementation way.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org