Improve chrono formatting

This commit is contained in:
Victor Zverovich
2025-04-12 09:00:43 -07:00
parent f470b9c566
commit f10b6dd816
2 changed files with 8 additions and 11 deletions

View File

@ -16,6 +16,7 @@
using fmt::runtime;
using fmt::sys_time;
using fmt::sys_time;
using testing::Contains;
#if defined(__MINGW32__) && !defined(_UCRT)
@ -238,8 +239,6 @@ TEST(chrono_test, format_to_empty_container) {
EXPECT_EQ(s, "42");
}
TEST(chrono_test, empty_result) { EXPECT_EQ(fmt::format("{}", std::tm()), ""); }
TEST(chrono_test, gmtime) {
auto t = std::time(nullptr);
auto expected = *std::gmtime(&t);
@ -337,6 +336,11 @@ TEST(chrono_test, local_time) {
fmt::format_error, "no timezone");
}
TEST(chrono_test, tm) {
auto time = fmt::gmtime(290088000);
test_time(time);
}
TEST(chrono_test, daylight_savings_time_end) {
// 2024-10-27 03:05 as the number of seconds since epoch in Europe/Kyiv time.
// It is slightly after the DST end and passing it to to_sys will result in