Repository: fmtlib/fmt
File: include/fmt/chrono.h (C/C++)

Code before:
    // By appending an extra space we can distinguish an empty result that
    // indicates insufficient buffer size from a guaranteed non-empty result
    // https://github.com/fmtlib/fmt/issues/2238
    tm_format.push_back(' ');
    tm_format.push_back('\0');
    basic_memory_buffer<Char> buf;
    size_t start = buf.size();
    for (;;) {
      size_t size = buf.capacity() - start;
      size_t count = detail::strftime(&buf[start], size, &tm_format[0], &tm);
      if (count != 0) {
        buf.resize(start + count);
        break;
      }
      const size_t MIN_GROWTH = 10;
      buf.reserve(buf.capacity() + (size > MIN_GROWTH ? size : MIN_GROWTH));
    }
    // Remove the extra space.
    return std::copy(buf.begin(), buf.end() - 1, ctx.out());
  }

  basic_string_view<Char> specs;
};

FMT_MODULE_EXPORT_END
namespace detail {
template <typename Period> FMT_CONSTEXPR const char* get_units() {
  return nullptr;
}
template <> FMT_CONSTEXPR inline const char* get_units<std::atto>() {
  return "as";
}
template <> FMT_CONSTEXPR inline const char* get_units<std::femto>() {
  return "fs";
}
template <> FMT_CONSTEXPR inline const char* get_units<std::pico>() {
  return "ps";
}
template <> FMT_CONSTEXPR inline const char* get_units<std::nano>() {
  return "ns";
}
template <> FMT_CONSTEXPR inline const char* get_units<std::micro>() {
  return "µs";
}
template <> FMT_CONSTEXPR inline const char* get_units<std::milli>() {
  return "ms";
}
template <> FMT_CONSTEXPR inline const char* get_units<std::centi>() {
  return "cs";
}
template <> FMT_CONSTEXPR inline const char* get_units<std::deci>() {

Review comment (suggestion):
I suggest adding `FMT_BEGIN_DETAIL_NAMESPACE` / `FMT_END_DETAIL_NAMESPACE` macros to avoid repeating this sequence throughout the code.

Code after:
    // By appending an extra space we can distinguish an empty result that
    // indicates insufficient buffer size from a guaranteed non-empty result
    // https://github.com/fmtlib/fmt/issues/2238
    tm_format.push_back(' ');
    tm_format.push_back('\0');
    basic_memory_buffer<Char> buf;
    size_t start = buf.size();
    for (;;) {
      size_t size = buf.capacity() - start;
      size_t count = detail::strftime(&buf[start], size, &tm_format[0], &tm);
      if (count != 0) {
        buf.resize(start + count);
        break;
      }
      const size_t MIN_GROWTH = 10;
      buf.reserve(buf.capacity() + (size > MIN_GROWTH ? size : MIN_GROWTH));
    }
    // Remove the extra space.
    return std::copy(buf.begin(), buf.end() - 1, ctx.out());
  }

  basic_string_view<Char> specs;
};

FMT_BEGIN_DETAIL_NAMESPACE

template <typename Period> FMT_CONSTEXPR const char* get_units() {
  return nullptr;
}
template <> FMT_CONSTEXPR inline const char* get_units<std::atto>() {
  return "as";
}
template <> FMT_CONSTEXPR inline const char* get_units<std::femto>() {
  return "fs";
}
template <> FMT_CONSTEXPR inline const char* get_units<std::pico>() {
  return "ps";
}
template <> FMT_CONSTEXPR inline const char* get_units<std::nano>() {
  return "ns";
}
template <> FMT_CONSTEXPR inline const char* get_units<std::micro>() {
  return "µs";
}
template <> FMT_CONSTEXPR inline const char* get_units<std::milli>() {
  return "ms";
}
template <> FMT_CONSTEXPR inline const char* get_units<std::centi>() {
  return "cs";
}
template <> FMT_CONSTEXPR inline const char* get_units<std::deci>() {