AnthonyCalandra / modern-cpp-features

A cheatsheet of modern C++ language and library features.
MIT License
19.6k stars 2.08k forks source link

Would be nice to include the new rounding functions in chrono in C++17 #132

Closed UPC-PaalDriveklepp closed 1 day ago

UPC-PaalDriveklepp commented 11 months ago
floor(std::chrono::duration)(C++17) converts a duration to another, rounding down(function template)
ceil(std::chrono::duration)(C++17) converts a duration to another, rounding up(function template)
round(std::chrono::duration)(C++17) converts a duration to another, rounding to nearest, ties to even(function template)
abs(std::chrono::duration)(C++17) obtains the absolute value of the duration(function template)

floor(std::chrono::duration)

(C++17)

converts a duration to another, rounding down (function template) ceil(std::chrono::duration)

(C++17)

converts a duration to another, rounding up (function template) round(std::chrono::duration)

(C++17)

converts a duration to another, rounding to nearest, ties to even (function template) abs(std::chrono::duration)

(C++17)

obtains the absolute value of the duration (function template)

AnthonyCalandra commented 1 day ago

Added in commit 3f054364ad8636a72cf8c9ef15e0b0457865bf44