The C++11 standard really marks an important step regarding time. Before that (C++ standard 98 and before), system and application developers had to rely on implementation-specific APIs (that is, POSIX) or external libraries (for example, boost) to manipulate time, which means less portable code. This recipe will teach you how to write C++ code by using the standard time manipulation library.
Learning about the C++ time interface
How to do it...
Let's write a program to learn about the concepts of clock, time point, and duration, as supported in the C++ standards:
- Create a new file and call it chrono_01.cpp. We need a few includes first:
#include <iostream>
#include <vector>
...