Skip to content

Commit e65ed43

Browse files
committed
Test tm timezone formatting
1 parent f10b6dd commit e65ed43

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

test/chrono-test.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,12 @@ TEST(chrono_test, local_time) {
339339
TEST(chrono_test, tm) {
340340
auto time = fmt::gmtime(290088000);
341341
test_time(time);
342+
if (fmt::detail::has_member_data_tm_gmtoff<std::tm>()) {
343+
EXPECT_EQ(fmt::format(fmt::runtime("{:%z}"), time), "+0000");
344+
EXPECT_EQ(fmt::format(fmt::runtime("{:%Ez}"), time), "+00:00");
345+
EXPECT_EQ(fmt::format(fmt::runtime("{:%Oz}"), time), "+00:00");
346+
EXPECT_EQ(fmt::format(fmt::runtime("{:%Z}"), time), "UTC");
347+
}
342348
}
343349

344350
TEST(chrono_test, daylight_savings_time_end) {

0 commit comments

Comments
 (0)