92970 {
92971
92972
92973
92974
92975 static constexpr idx_t RENDER_SIZE = 26;
92976
92977 if (seconds < 0 || seconds == 2147483647) {
92978
92979 return string(RENDER_SIZE, ' ');
92980 }
92981
92982 if (!elapsed && seconds > 3600 * 99) {
92983
92984 return string(RENDER_SIZE, ' ');
92985 }
92986
92987
92988 auto total_centiseconds =
static_cast<uint64_t>(std::llround(seconds * 100.0));
92989
92990
92991 uint64_t total_seconds = total_centiseconds / 100;
92993
92994
92995 uint64_t hours = total_seconds / 3600;
92998 string result;
92999 result = "(";
93000 if (!elapsed) {
93001 if (hours == 0 && minutes == 0 && secs == 0) {
93003 } else if (hours == 0 && minutes == 0) {
93005 } else if (hours == 0) {
93006 auto minute_fraction =
static_cast<uint32_t>(
static_cast<double>(secs) / 60.0 * 10);
93008 } else {
93009 auto hour_fraction =
static_cast<uint32_t>(
static_cast<double>(minutes) / 60.0 * 10);
93011 }
93012 result += " remaining";
93013 } else {
93014 result +=
StringUtil::Format(
"%02llu:%02u:%02u.%02llu", hours, minutes, secs, centiseconds);
93015 result += " elapsed";
93016 }
93017 result += ")";
93018 if (result.size() < RENDER_SIZE) {
93019 result += string(RENDER_SIZE - result.size(), ' ');
93020 }
93021 return result;
93022}
static string Format(const string fmt_str, ARGS... params)
Format a string using printf semantics.
Definition duckdb.hpp:4002