Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions CPP17.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<seconds>(d); // == 6s
std::chrono::ceil<seconds>(d); // == 6s
std::chrono::floor<seconds>(d); // == 5s
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<seconds>(d); // == 6s
std::chrono::ceil<seconds>(d); // == 6s
std::chrono::floor<seconds>(d); // == 5s
Expand Down