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