diff --git a/CPP17.md b/CPP17.md index 56b966f..ff17060 100644 --- a/CPP17.md +++ b/CPP17.md @@ -690,9 +690,10 @@ 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 +using std::chrono::seconds; +using std::chrono::milliseconds; +milliseconds a{ -5500 }; +milliseconds d = std::chromo::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..426757f 100644 --- a/README.md +++ b/README.md @@ -1495,9 +1495,10 @@ 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 +using std::chrono::seconds; +using std::chrono::milliseconds; +milliseconds a{ -5500 }; +milliseconds d = std::chromo::abs(a); // 5500ms std::chrono::round(d); // == 6s std::chrono::ceil(d); // == 6s std::chrono::floor(d); // == 5s