fix chrono
This commit is contained in:
parent
b75bd49b6c
commit
2f9484c74b
@ -769,7 +769,7 @@ template <typename Char, typename Rep, typename OutputIt,
|
|||||||
FMT_ENABLE_IF(std::is_integral<Rep>::value)>
|
FMT_ENABLE_IF(std::is_integral<Rep>::value)>
|
||||||
OutputIt format_duration_value(OutputIt out, Rep val, int) {
|
OutputIt format_duration_value(OutputIt out, Rep val, int) {
|
||||||
static FMT_CONSTEXPR_DECL const Char format[] = {'{', '}', 0};
|
static FMT_CONSTEXPR_DECL const Char format[] = {'{', '}', 0};
|
||||||
return format_to(out, compile_string_to_view(format), val);
|
return format_to(out, FMT_STRING(format), val);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Char, typename Rep, typename OutputIt,
|
template <typename Char, typename Rep, typename OutputIt,
|
||||||
@ -778,9 +778,9 @@ OutputIt format_duration_value(OutputIt out, Rep val, int precision) {
|
|||||||
static FMT_CONSTEXPR_DECL const Char pr_f[] = {'{', ':', '.', '{',
|
static FMT_CONSTEXPR_DECL const Char pr_f[] = {'{', ':', '.', '{',
|
||||||
'}', 'f', '}', 0};
|
'}', 'f', '}', 0};
|
||||||
if (precision >= 0)
|
if (precision >= 0)
|
||||||
return format_to(out, compile_string_to_view(pr_f), val, precision);
|
return format_to(out, FMT_STRING(pr_f), val, precision);
|
||||||
static FMT_CONSTEXPR_DECL const Char fp_f[] = {'{', ':', 'g', '}', 0};
|
static FMT_CONSTEXPR_DECL const Char fp_f[] = {'{', ':', 'g', '}', 0};
|
||||||
return format_to(out, compile_string_to_view(fp_f), val);
|
return format_to(out, FMT_STRING(fp_f), val);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Char, typename OutputIt>
|
template <typename Char, typename OutputIt>
|
||||||
@ -802,10 +802,10 @@ OutputIt format_duration_unit(OutputIt out) {
|
|||||||
return copy_unit(string_view(unit), out, Char());
|
return copy_unit(string_view(unit), out, Char());
|
||||||
static FMT_CONSTEXPR_DECL const Char num_f[] = {'[', '{', '}', ']', 's', 0};
|
static FMT_CONSTEXPR_DECL const Char num_f[] = {'[', '{', '}', ']', 's', 0};
|
||||||
if (const_check(Period::den == 1))
|
if (const_check(Period::den == 1))
|
||||||
return format_to(out, compile_string_to_view(num_f), Period::num);
|
return format_to(out, FMT_STRING(num_f), Period::num);
|
||||||
static FMT_CONSTEXPR_DECL const Char num_def_f[] = {'[', '{', '}', '/', '{',
|
static FMT_CONSTEXPR_DECL const Char num_def_f[] = {'[', '{', '}', '/', '{',
|
||||||
'}', ']', 's', 0};
|
'}', ']', 's', 0};
|
||||||
return format_to(out, compile_string_to_view(num_def_f), Period::num,
|
return format_to(out, FMT_STRING(num_def_f), Period::num,
|
||||||
Period::den);
|
Period::den);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -279,13 +279,13 @@ TEST(FormatTest, FmtStringInTemplate) {
|
|||||||
#include "fmt/chrono.h"
|
#include "fmt/chrono.h"
|
||||||
|
|
||||||
#ifndef FMT_STATIC_THOUSANDS_SEPARATOR
|
#ifndef FMT_STATIC_THOUSANDS_SEPARATOR
|
||||||
/*
|
|
||||||
TEST(ChronoTest, FormatDefault) {
|
TEST(ChronoTest, FormatDefault) {
|
||||||
EXPECT_EQ("42s", fmt::format(FMT_STRING("{}"), std::chrono::seconds(42)));
|
EXPECT_EQ("42s", fmt::format(FMT_STRING("{}"), std::chrono::seconds(42)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ChronoTest, FormatWide) {
|
TEST(ChronoTest, FormatWide) {
|
||||||
EXPECT_EQ(L"42s", fmt::format(L"{}", std::chrono::seconds(42)));
|
EXPECT_EQ(L"42s", fmt::format(FMT_STRING(L"{}"), std::chrono::seconds(42)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef std::chrono::duration<double, std::milli> dms;
|
typedef std::chrono::duration<double, std::milli> dms;
|
||||||
@ -327,7 +327,7 @@ TEST(ChronoTest, FormatFullSpecsQq) {
|
|||||||
TEST(ChronoTest, UnsignedDuration) {
|
TEST(ChronoTest, UnsignedDuration) {
|
||||||
EXPECT_EQ("42s", fmt::format(FMT_STRING("{}"), std::chrono::duration<unsigned>(42)));
|
EXPECT_EQ("42s", fmt::format(FMT_STRING("{}"), std::chrono::duration<unsigned>(42)));
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
#endif // FMT_STATIC_THOUSANDS_SEPARATOR
|
#endif // FMT_STATIC_THOUSANDS_SEPARATOR
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user