Unverified Commit 90034e4c authored by Vladislav Shchapov's avatar Vladislav Shchapov Committed by GitHub

Add FMT_ASSERT and validation of values of struct tm members (#2564)

Switch internal year calculations to long long
parent df40e946
This diff is collapsed.
...@@ -93,6 +93,13 @@ TEST(chrono_test, format_tm) { ...@@ -93,6 +93,13 @@ TEST(chrono_test, format_tm) {
EXPECT_EQ(fmt::format("{:%Y}", tm), "0027"); EXPECT_EQ(fmt::format("{:%Y}", tm), "0027");
EXPECT_EQ(fmt::format("{:%C%y}", tm), "0027"); EXPECT_EQ(fmt::format("{:%C%y}", tm), "0027");
// Overflow year
tm.tm_year = 2147483647;
EXPECT_EQ(fmt::format("{:%Y}", tm), "2147485547");
tm.tm_year = -2147483648;
EXPECT_EQ(fmt::format("{:%Y}", tm), "-2147481748");
// for week on the year // for week on the year
// https://www.cl.cam.ac.uk/~mgk25/iso-time.html // https://www.cl.cam.ac.uk/~mgk25/iso-time.html
std::vector<std::tm> tm_list = { std::vector<std::tm> tm_list = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment