remove time_point-fix.patch

this patch is already included in fmt-10.1.1

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
This commit is contained in:
Kefu Chai 2023-11-15 14:14:50 +08:00
parent 75f733693a
commit 35528177d1
2 changed files with 1 additions and 64 deletions

View File

@ -1,63 +0,0 @@
From d7592ad8bfa41eda239497f672ae8dc7bda00a4b Mon Sep 17 00:00:00 2001
From: Patrick Geltinger <patlkli@patlkli.org>
Date: Fri, 12 May 2023 00:25:21 +0200
Subject: [PATCH] Fix time_point formatting for durations with certain ratios
(#3430)
* Fix time_point formatting
* Add timestamps_ratios tests
---
include/fmt/chrono.h | 3 ++-
test/chrono-test.cc | 24 ++++++++++++++++++++++++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h
index 1a2a12cf767..43daeeb4d39 100644
--- a/include/fmt/chrono.h
+++ b/include/fmt/chrono.h
@@ -2142,7 +2142,8 @@ struct formatter<std::chrono::time_point<std::chrono::system_clock, Duration>,
epoch - std::chrono::duration_cast<std::chrono::seconds>(epoch));
if (subsecs.count() < 0) {
- auto second = std::chrono::seconds(1);
+ auto second = std::chrono::duration_cast<Duration>(
+ std::chrono::seconds(1));
if (epoch.count() < ((Duration::min)() + second).count())
FMT_THROW(format_error("duration is too small"));
subsecs += second;
diff --git a/test/chrono-test.cc b/test/chrono-test.cc
index 8e2772fa0f6..33c0c2c6653 100644
--- a/test/chrono-test.cc
+++ b/test/chrono-test.cc
@@ -850,6 +850,30 @@ TEST(chrono_test, utc_clock) {
}
#endif
+TEST(chrono_test, timestamps_ratios) {
+ std::chrono::time_point<std::chrono::system_clock, std::chrono::milliseconds>
+ t1(std::chrono::milliseconds(67890));
+
+ EXPECT_EQ(fmt::format("{:%M:%S}", t1), "01:07.890");
+
+ std::chrono::time_point<std::chrono::system_clock, std::chrono::minutes>
+ t2(std::chrono::minutes(7));
+
+ EXPECT_EQ(fmt::format("{:%M:%S}", t2), "07:00");
+
+ std::chrono::time_point<std::chrono::system_clock,
+ std::chrono::duration<int, std::ratio<9>>>
+ t3(std::chrono::duration<int, std::ratio<9>>(7));
+
+ EXPECT_EQ(fmt::format("{:%M:%S}", t3), "01:03");
+
+ std::chrono::time_point<std::chrono::system_clock,
+ std::chrono::duration<int, std::ratio<63>>>
+ t4(std::chrono::duration<int, std::ratio<63>>(1));
+
+ EXPECT_EQ(fmt::format("{:%M:%S}", t4), "01:03");
+}
+
TEST(chrono_test, timestamps_sub_seconds) {
std::chrono::time_point<std::chrono::system_clock,
std::chrono::duration<long long, std::ratio<1, 3>>>

View File

@ -1 +1 @@
SHA512 (10.0.0.tar.gz) = 6188508d74ca1ed75bf6441b152c07ca83971d3104b37f33784a7b55dfcc614d6243e77e0a14220018586fdb86207cc033eece834e7acd5e0907ed4c97403f3b SHA512 (10.1.1.tar.gz) = 288c349baac5f96f527d5b1bed0fa5f031aa509b4526560c684281388e91909a280c3262a2474d963b5d1bf7064b1c9930c6677fe54a0d8f86982d063296a54c