34 dispatcher(std::time_t
t): time_(t) {}
37 using namespace fmt::internal;
38 return handle(localtime_r(&time_, &tm_));
41 bool handle(std::tm *tm) {
return tm !=
FMT_NULL; }
44 using namespace fmt::internal;
48 bool fallback(
int res) {
return res == 0; }
52 using namespace fmt::internal;
72 dispatcher(std::time_t
t): time_(t) {}
75 using namespace fmt::internal;
76 return handle(
gmtime_r(&time_, &tm_));
79 bool handle(std::tm *tm) {
return tm !=
FMT_NULL; }
82 using namespace fmt::internal;
83 return fallback(
gmtime_s(&tm_, &time_));
86 bool fallback(
int res) {
return res == 0; }
105 const std::tm *
time) {
111 return std::wcsftime(str, count, format, time);
115 template <
typename Char>
117 template <
typename ParseContext>
118 auto parse(ParseContext &ctx) -> decltype(ctx.begin()) {
119 auto it = ctx.begin();
120 if (it != ctx.end() && *it ==
':')
123 while (
end != ctx.end() && *
end !=
'}')
126 tm_format.append(it,
end);
127 tm_format.push_back(
'\0');
131 template <
typename FormatContext>
132 auto format(
const std::tm &tm, FormatContext &ctx) -> decltype(ctx.out()) {
134 std::size_t start = buf.
size();
140 buf.
resize(start + count);
143 if (size >= tm_format.size() * 256) {
150 const std::size_t MIN_GROWTH = 10;
160 #endif // FMT_TIME_H_
std::size_t strftime(wchar_t *str, std::size_t count, const wchar_t *format, const std::tm *time)
void resize(std::size_t new_size)
#define FMT_END_NAMESPACE
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
FMT_CONSTEXPR auto end(const C &c) -> decltype(c.end())
null localtime_r FMT_NOMACRO(...)
std::tm localtime(std::time_t time)
std::size_t strftime(char *str, std::size_t count, const char *format, const std::tm *time)
std::size_t size() const FMT_NOEXCEPT
std::size_t capacity() const FMT_NOEXCEPT
void reserve(std::size_t new_capacity)
std::string str(const std::pair< Type, Type > &tt)
std::tm gmtime(std::time_t time)
FMT_CONSTEXPR std::make_unsigned< Int >::type to_unsigned(Int value)