Skip to content

Commit

Permalink
Merge pull request #3855 from actiontech/2311
Browse files Browse the repository at this point in the history
[inner-2311] fix: precision is missing when datetime/timestamp/time are converted to strings
  • Loading branch information
wenyh1 authored and ylinzhu committed Mar 4, 2024
1 parent 316e070 commit d0ae096
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/main/java/com/actiontech/dble/plan/common/time/MyTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit d0ae096

Please sign in to comment.