230493 {
230494
230495 switch (specifier) {
230496 case StrTimeSpecifier::DAY_OF_MONTH_PADDED:
230497 target = WritePadded2(target, UnsafeNumericCast<uint32_t>(data[2]));
230498 break;
230499 case StrTimeSpecifier::ABBREVIATED_MONTH_NAME: {
230500 auto &month_name = Date::MONTH_NAMES_ABBREVIATED[data[1] - 1];
230501 return WriteString(target, month_name);
230502 }
230503 case StrTimeSpecifier::FULL_MONTH_NAME: {
230504 auto &month_name = Date::MONTH_NAMES[data[1] - 1];
230505 return WriteString(target, month_name);
230506 }
230507 case StrTimeSpecifier::MONTH_DECIMAL_PADDED:
230508 target = WritePadded2(target, UnsafeNumericCast<uint32_t>(data[1]));
230509 break;
230510 case StrTimeSpecifier::YEAR_WITHOUT_CENTURY_PADDED:
230511 target = WritePadded2(target, UnsafeNumericCast<uint32_t>(AbsValue(data[0]) % 100));
230512 break;
230513 case StrTimeSpecifier::YEAR_DECIMAL:
230514 if (data[0] >= 0 && data[0] <= 9999) {
230515 target = WritePadded(target, UnsafeNumericCast<uint32_t>(data[0]), 4);
230516 } else {
230518 if (data[0] < 0) {
230519 *target = '-';
230520 year = -year;
230521 target++;
230522 }
230523 auto len = NumericHelper::UnsignedLength<uint32_t>(UnsafeNumericCast<uint32_t>(year));
230524 NumericHelper::FormatUnsigned(year, target + len);
230525 target += len;
230526 }
230527 break;
230528 case StrTimeSpecifier::HOUR_24_PADDED: {
230529 target = WritePadded2(target, UnsafeNumericCast<uint32_t>(data[3]));
230530 break;
230531 }
230532 case StrTimeSpecifier::HOUR_12_PADDED: {
230533 int hour = data[3] % 12;
230534 if (hour == 0) {
230535 hour = 12;
230536 }
230537 target = WritePadded2(target, UnsafeNumericCast<uint32_t>(hour));
230538 break;
230539 }
230540 case StrTimeSpecifier::AM_PM:
230541 *target++ = data[3] >= 12 ? 'P' : 'A';
230542 *target++ = 'M';
230543 break;
230544 case StrTimeSpecifier::MINUTE_PADDED: {
230545 target = WritePadded2(target, UnsafeNumericCast<uint32_t>(data[4]));
230546 break;
230547 }
230548 case StrTimeSpecifier::SECOND_PADDED:
230549 target = WritePadded2(target, UnsafeNumericCast<uint32_t>(data[5]));
230550 break;
230551 case StrTimeSpecifier::NANOSECOND_PADDED:
230552 target = WritePadded(target, UnsafeNumericCast<uint32_t>(data[6]), 9);
230553 break;
230554 case StrTimeSpecifier::MICROSECOND_PADDED:
230555 target = WritePadded(target, UnsafeNumericCast<uint32_t>(data[6] / Interval::NANOS_PER_MICRO), 6);
230556 break;
230557 case StrTimeSpecifier::MILLISECOND_PADDED:
230558 target = WritePadded3(target, UnsafeNumericCast<uint32_t>(data[6] / Interval::NANOS_PER_MSEC));
230559 break;
230560 case StrTimeSpecifier::UTC_OFFSET: {
230561 *target++ = (data[7] < 0) ? '-' : '+';
230562
230563 auto offset =
abs(data[7]);
230564 int hh, mm, ss;
230565 StrfTimeSplitOffset(offset, hh, mm, ss);
230566 target = WritePadded2(target, UnsafeNumericCast<uint32_t>(hh));
230567 if (mm || ss) {
230568 *target++ = ':';
230569 target = WritePadded2(target, UnsafeNumericCast<uint32_t>(mm));
230570 }
230571 if (ss) {
230572 *target++ = ':';
230573 target = WritePadded2(target, UnsafeNumericCast<uint32_t>(ss));
230574 }
230575 break;
230576 }
230577 case StrTimeSpecifier::TZ_NAME:
230578 if (tz_name) {
230579 memcpy(target, tz_name, tz_len);
230580 target += strlen(tz_name);
230581 }
230582 break;
230583 case StrTimeSpecifier::DAY_OF_MONTH: {
230584 target = Write2(target, UnsafeNumericCast<uint8_t>(data[2] % 100));
230585 break;
230586 }
230587 case StrTimeSpecifier::MONTH_DECIMAL: {
230588 target = Write2(target, UnsafeNumericCast<uint8_t>(data[1]));
230589 break;
230590 }
230591 case StrTimeSpecifier::YEAR_WITHOUT_CENTURY: {
230592 target = Write2(target, UnsafeNumericCast<uint8_t>(AbsValue(data[0]) % 100));
230593 break;
230594 }
230595 case StrTimeSpecifier::HOUR_24_DECIMAL: {
230596 target = Write2(target, UnsafeNumericCast<uint8_t>(data[3]));
230597 break;
230598 }
230599 case StrTimeSpecifier::HOUR_12_DECIMAL: {
230600 int hour = data[3] % 12;
230601 if (hour == 0) {
230602 hour = 12;
230603 }
230604 target = Write2(target, UnsafeNumericCast<uint8_t>(hour));
230605 break;
230606 }
230607 case StrTimeSpecifier::MINUTE_DECIMAL: {
230608 target = Write2(target, UnsafeNumericCast<uint8_t>(data[4]));
230609 break;
230610 }
230611 case StrTimeSpecifier::SECOND_DECIMAL: {
230612 target = Write2(target, UnsafeNumericCast<uint8_t>(data[5]));
230613 break;
230614 }
230615 default:
230616 throw InternalException("Unimplemented specifier for WriteStandardSpecifier in strftime");
230617 }
230618 return target;
230619}
__device__ __forceinline__ uchar1 abs(const uchar1 &a)