mirror of
https://github.com/DevEhChad/cpp-cheatsheet.git
synced 2025-11-08 22:01:35 +00:00
Add chrono
This commit is contained in:
@@ -511,8 +511,9 @@ auto from = // Get current time_point
|
|||||||
// ... do some work
|
// ... do some work
|
||||||
auto to = // Get current time_point
|
auto to = // Get current time_point
|
||||||
high_resolution_clock::now();
|
high_resolution_clock::now();
|
||||||
using ms = // Compute duration in milliseconds
|
using ms = // Define ms as floating point duration
|
||||||
duration<float, milliseconds::period>;
|
duration<float, milliseconds::period>;
|
||||||
|
// Compute duration in milliseconds
|
||||||
cout << duration_cast<ms>(to - from)
|
cout << duration_cast<ms>(to - from)
|
||||||
.count() << "ms";
|
.count() << "ms";
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user