|
| static int32_t | FormatMicros (int32_t microseconds, char micro_buffer[]) |
| | Format microseconds to a buffer of length 6. Returns the number of trailing zeros.
|
| |
| static idx_t | MicrosLength (int32_t micros, char micro_buffer[]) |
| |
| static idx_t | Length (int32_t time[], char micro_buffer[]) |
| |
| static void | FormatTwoDigits (char *ptr, int32_t value) |
| |
| static void | Format (char *data, idx_t length, int32_t hour, int32_t minute, int32_t second, int32_t microsecond, char micro_buffer[]) |
| |
| static void | Format (char *data, idx_t length, int32_t time[], char micro_buffer[]) |
| |
◆ FormatMicros()
Format microseconds to a buffer of length 6. Returns the number of trailing zeros.
19945 {
19946 char *endptr = micro_buffer + 6;
19947 endptr = NumericHelper::FormatUnsigned<int32_t>(microseconds, endptr);
19948 while (endptr > micro_buffer) {
19949 *--endptr = '0';
19950 }
19951 idx_t trailing_zeros = 0;
19952 for (idx_t i = 5; i > 0; i--) {
19953 if (micro_buffer[i] != '0') {
19954 break;
19955 }
19956 trailing_zeros++;
19957 }
19958 return UnsafeNumericCast<int32_t>(trailing_zeros);
19959 }
◆ MicrosLength()
19961 {
19962
19963
19964 idx_t length;
19965 if (micros == 0) {
19966
19967
19968 length = 8;
19969 } else {
19970 length = 15;
19971
19972
19973
19974
19975
19976 length -= NumericCast<idx_t>(
FormatMicros(micros, micro_buffer));
19977 }
19978 return length;
19979 }
static int32_t FormatMicros(int32_t microseconds, char micro_buffer[])
Format microseconds to a buffer of length 6. Returns the number of trailing zeros.
Definition duckdb.cpp:19945
◆ Length()
19981 {
19982 return MicrosLength(time[3], micro_buffer);
19983 }
◆ FormatTwoDigits()
19985 {
19986 D_ASSERT(value >= 0 && value <= 99);
19987 if (value < 10) {
19988 ptr[0] = '0';
19989 ptr[1] = UnsafeNumericCast<char>('0' + value);
19990 } else {
19991 auto index = UnsafeNumericCast<unsigned>(value * 2);
19992 ptr[0] = duckdb_fmt::internal::data::digits[
index];
19993 ptr[1] = duckdb_fmt::internal::data::digits[
index + 1];
19994 }
19995 }
◆ Format() [1/2]
19998 {
19999
20000 FormatTwoDigits(data, hour);
20001 data[2] = ':';
20002 FormatTwoDigits(data + 3, minute);
20003 data[5] = ':';
20004 FormatTwoDigits(data + 6, second);
20005 if (length > 8) {
20006
20007 data[8] = '.';
20008 memcpy(data + 9, micro_buffer, length - 9);
20009 }
20010 }
◆ Format() [2/2]
20012 {
20013 Format(data, length, time[0], time[1], time[2], time[3], micro_buffer);
20014 }
The documentation for this struct was generated from the following file:
- external/duckdb/duckdb.cpp