From 65db836b216bfc9a6c8f0f3867bb6cbf17ad05f0 Mon Sep 17 00:00:00 2001 From: huangfu Date: Wed, 31 May 2023 18:11:40 +0800 Subject: [PATCH] =?UTF-8?q?=E9=92=88=E5=AF=B9=E6=97=B6=E9=97=B4=E7=B2=BE?= =?UTF-8?q?=E5=BA=A6=EF=BC=8C=E9=BB=98=E8=AE=A4=E4=B8=BA=E6=AF=AB=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chunjun/connector/jdbc/util/JdbcUtil.java | 31 ++----------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/chunjun-connectors/chunjun-connector-jdbc-base/src/main/java/com/dtstack/chunjun/connector/jdbc/util/JdbcUtil.java b/chunjun-connectors/chunjun-connector-jdbc-base/src/main/java/com/dtstack/chunjun/connector/jdbc/util/JdbcUtil.java index d932084a06..388028f898 100644 --- a/chunjun-connectors/chunjun-connector-jdbc-base/src/main/java/com/dtstack/chunjun/connector/jdbc/util/JdbcUtil.java +++ b/chunjun-connectors/chunjun-connector-jdbc-base/src/main/java/com/dtstack/chunjun/connector/jdbc/util/JdbcUtil.java @@ -392,20 +392,7 @@ public static String getNanosTimeStr(String timeStr) { */ public static int getNanos(long startLocation) { String timeStr = String.valueOf(startLocation); - int nanos; - if (timeStr.length() == SECOND_LENGTH) { - nanos = 0; - } else if (timeStr.length() == MILLIS_LENGTH) { - nanos = Integer.parseInt(timeStr.substring(SECOND_LENGTH, MILLIS_LENGTH)) * 1000000; - } else if (timeStr.length() == MICRO_LENGTH) { - nanos = Integer.parseInt(timeStr.substring(SECOND_LENGTH, MICRO_LENGTH)) * 1000; - } else if (timeStr.length() == NANOS_LENGTH) { - nanos = Integer.parseInt(timeStr.substring(SECOND_LENGTH, NANOS_LENGTH)); - } else { - throw new IllegalArgumentException("Unknown time unit:startLocation=" + startLocation); - } - - return nanos; + return Integer.parseInt(timeStr.substring(SECOND_LENGTH)) * 1000000; } /** @@ -415,21 +402,7 @@ public static int getNanos(long startLocation) { * @return */ public static long getMillis(long startLocation) { - String timeStr = String.valueOf(startLocation); - long millisSecond; - if (timeStr.length() == SECOND_LENGTH) { - millisSecond = startLocation * 1000; - } else if (timeStr.length() == MILLIS_LENGTH) { - millisSecond = startLocation; - } else if (timeStr.length() == MICRO_LENGTH) { - millisSecond = startLocation / 1000; - } else if (timeStr.length() == NANOS_LENGTH) { - millisSecond = startLocation / 1000000; - } else { - throw new IllegalArgumentException("Unknown time unit:startLocation=" + startLocation); - } - - return millisSecond; + return startLocation; } /**