From b443766792bf43f6e4563e2cb33ef660f8091a5e Mon Sep 17 00:00:00 2001 From: hanfezh Date: Fri, 16 May 2025 18:04:14 +0800 Subject: [PATCH 1/2] Correct std::chrono::abs --- CPP17.md | 7 ++++--- README.md | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) 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 From 6ef573eea2f5996f90a6a6f5000c609f56e134af Mon Sep 17 00:00:00 2001 From: hanfezh Date: Sun, 1 Jun 2025 22:42:46 +0800 Subject: [PATCH 2/2] Correct the spelling of chrono --- CPP17.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CPP17.md b/CPP17.md index ff17060..d114934 100644 --- a/CPP17.md +++ b/CPP17.md @@ -693,7 +693,7 @@ Provides abs, round, ceil, and floor helper functions for `std::chrono::duration using std::chrono::seconds; using std::chrono::milliseconds; milliseconds a{ -5500 }; -milliseconds d = std::chromo::abs(a); // 5500ms +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 426757f..51d8055 100644 --- a/README.md +++ b/README.md @@ -1498,7 +1498,7 @@ Provides abs, round, ceil, and floor helper functions for `std::chrono::duration using std::chrono::seconds; using std::chrono::milliseconds; milliseconds a{ -5500 }; -milliseconds d = std::chromo::abs(a); // 5500ms +milliseconds d = std::chrono::abs(a); // 5500ms std::chrono::round(d); // == 6s std::chrono::ceil(d); // == 6s std::chrono::floor(d); // == 5s