diff --git a/CPP17.md b/CPP17.md index 56b966f..093c288 100644 --- a/CPP17.md +++ b/CPP17.md @@ -690,9 +690,8 @@ else { /* handle failure */ } ### Rounding functions for chrono durations and timepoints Provides abs, round, ceil, and floor helper functions for `std::chrono::duration` and `std::chrono::time_point`. ```c++ -using seconds = std::chrono::seconds; -std::chrono::milliseconds d{ 5500 }; -std::chrono::abs(d); // == 5s +std::chrono::milliseconds a{ -5500 }; +std::chrono::milliseconds d = std::chrono::abs(a); // == 5500ms std::chrono::round(d); // == 6s std::chrono::ceil(d); // == 6s std::chrono::floor(d); // == 5s diff --git a/README.md b/README.md index f4dfbae..c4cf98a 100644 --- a/README.md +++ b/README.md @@ -1495,9 +1495,8 @@ else { /* handle failure */ } ### Rounding functions for chrono durations and timepoints Provides abs, round, ceil, and floor helper functions for `std::chrono::duration` and `std::chrono::time_point`. ```c++ -using seconds = std::chrono::seconds; -std::chrono::milliseconds d{ 5500 }; -std::chrono::abs(d); // == 5s +std::chrono::milliseconds a{ -5500 }; +std::chrono::milliseconds d = std::chrono::abs(a); // == 5500ms std::chrono::round(d); // == 6s std::chrono::ceil(d); // == 6s std::chrono::floor(d); // == 5s