HappenLee commented on code in PR #15312: URL: https://github.com/apache/doris/pull/15312#discussion_r1058768522
########## be/src/util/date_func.cpp: ########## @@ -109,4 +109,28 @@ int32_t time_to_buffer_from_double(double time, char* buffer) { return buffer - begin; } +std::string time_to_buffer_from_double(double time) { + fmt::memory_buffer buffer; + if (time < 0) { + time = -time; + fmt::format_to(buffer, "-"); + } + if (time > 3020399) { + time = 3020399; + } + int64_t hour = (int64_t)(time / 3600); + int32_t minute = ((int32_t)(time / 60)) % 60; + int32_t second = ((int32_t)time) % 60; + if (hour >= 100) { + fmt::format_to(buffer, fmt::format("{}", hour)); Review Comment: use `{:2d}` to do format -- 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. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org