From 568346094848192c03224a60098a1e7f5c65ea7c Mon Sep 17 00:00:00 2001 From: wenyh <44251917+wenyh1@users.noreply.github.com> Date: Tue, 2 Jan 2024 10:15:23 +0800 Subject: [PATCH] Merge pull request #3855 from actiontech/2311 [inner-2311] fix: precision is missing when datetime/timestamp/time are converted to strings --- .../com/actiontech/dble/plan/common/time/MyTime.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/actiontech/dble/plan/common/time/MyTime.java b/src/main/java/com/actiontech/dble/plan/common/time/MyTime.java index 5263c93c68..0124c2eb03 100644 --- a/src/main/java/com/actiontech/dble/plan/common/time/MyTime.java +++ b/src/main/java/com/actiontech/dble/plan/common/time/MyTime.java @@ -1084,9 +1084,8 @@ public static String myTimeToStrL(MySQLTime lTime, long dec) { String stime = String.format("%s%02d:%02d:%02d", (lTime.isNeg() ? "-" : ""), lTime.getHour(), lTime.getMinute(), lTime.getSecond()); if (dec != 0) { - // TODO: 6 digits after Decimal point - // String stmp = String.format("%06d", l_time.second_part); - // stime += "." + stmp.substring(0, (int) dec); + String temp = String.format("%06d", lTime.getSecondPart()); + stime += "." + temp.substring(0, (int) dec); } return stime; } @@ -1107,9 +1106,8 @@ public static String myDatetimeToStr(final MySQLTime lTime, long dec) { timeToDatetimeStr(ptrtmp, lTime); String res = ptrtmp.get(); if (dec != 0) { - // TODO: 6 digits after Decimal point - // String stmp = String.format("%06d", l_time.second_part); - // res += "." + stmp.substring(0, (int) dec); + String temp = String.format("%06d", lTime.getSecondPart()); + res += "." + temp.substring(0, (int) dec); } return res; }