Modern C++ idoms and recipes

meshell
58K views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Measure Time Intervals

C++11 provides a flexible date and time library as part of the standard library that allows to define time points and time intervals. The library is called chrono and is available in the <chrono> header in the std::chrono namespace.

Exercise

Write a method which measures the execution time of a function

Time intervals

Exercise

Define the durations and intervals (i.e. do the TODOs)

Bonus exercise

Define user defined literals for day/days and week/weeks and use them together with the chrono literals to define the intervals in the exercise above.

Open Source Your Knowledge: become a Contributor and help others learn. Create New Content