Skip to content

Commit

Permalink
Fix error.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shylock-Hg committed Jan 13, 2022
1 parent 163d3a6 commit 8ef98ea
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/common/datatypes/Date.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,11 @@ void Time::subDuration(const Duration& duration) {
}

std::string Time::toString() const {
auto microsecStr = folly::stringPrintf("%.9f", static_cast<uint32_t>(microsec) / 1000000.0);
auto decimalPart = decimal(microsecStr);
// It's in current timezone already
return folly::stringPrintf("%02d:%02d:%02d%s", hour, minute, sec, decimalPart.c_str());
return folly::sformat("{:0>2}:{:0>2}:{:0>2}.{:0>6}000",
static_cast<uint8_t>(hour),
static_cast<uint8_t>(minute),
static_cast<uint8_t>(sec),
static_cast<uint32_t>(microsec));
}

void DateTime::addDuration(const Duration& duration) {
Expand Down

0 comments on commit 8ef98ea

Please sign in to comment.