91929 {
91931 Time::Convert(input.time(), time[0], time[1], time[2], time[3]);
91932
91933 char micro_buffer[10] = {};
91934 const auto time_length = TimeToStringCast::Length(time, micro_buffer);
91935 idx_t length = time_length;
91936
91937 const auto offset = input.offset();
91938 const bool negative = (offset < 0);
91939 ++length;
91940
91941 auto ss = std::abs(offset);
91942 const auto hh = ss / Interval::SECS_PER_HOUR;
91943
91944 const auto hh_length = UnsafeNumericCast<idx_t>((hh < 100) ? 2 : NumericHelper::UnsignedLength(
uint32_t(hh)));
91945 length += hh_length;
91946
91947 ss %= Interval::SECS_PER_HOUR;
91948 const auto mm = ss / Interval::SECS_PER_MINUTE;
91949 if (mm) {
91950 length += 3;
91951 }
91952
91953 ss %= Interval::SECS_PER_MINUTE;
91954 if (ss) {
91955 length += 3;
91956 }
91957
91959 auto data = result.GetDataWriteable();
91960
91962 TimeToStringCast::Format(data + pos, time_length, time, micro_buffer);
91963 pos += time_length;
91964
91965 data[pos++] = negative ? '-' : '+';
91966 if (hh < 100) {
91967 TimeToStringCast::FormatTwoDigits(data + pos, hh);
91968 } else {
91969 NumericHelper::FormatUnsigned(hh, data + pos + hh_length);
91970 }
91971 pos += hh_length;
91972
91973 if (mm) {
91974 data[pos++] = ':';
91975 TimeToStringCast::FormatTwoDigits(data + pos, mm);
91976 pos += 2;
91977 }
91978
91979 if (ss) {
91980 data[pos++] = ':';
91981 TimeToStringCast::FormatTwoDigits(data + pos, ss);
91982 pos += 2;
91983 }
91984
91985 result.Finalize();
91986 return result;
91987}
static DUCKDB_API void Convert(dtime_t time, int32_t &out_hour, int32_t &out_min, int32_t &out_sec, int32_t &out_micros)
Extract the time from a given timestamp object.
Definition duckdb.cpp:129382
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
static DUCKDB_API string_t EmptyString(Vector &vector, idx_t len)
Definition duckdb.cpp:137942