Embedded applications handle events and control processes happening in the physical world—that is why the correct handling of time and delays is crucial for them. Switching traffic lights; generation of sound tones; synchronization of data from multiple sensors—all these tasks rely on proper time measurements.
Plain C does not provide any standard functions to work with time. It is expected that application developers will use a time API specific for the target operating system—Windows, Linux, or macOS. For bare-metal embedded systems, developers have to create custom functions to work with time, based on a low-level timer API specific for the target platform. As a result, the code is hard to port to other platforms.Â
To overcome the portability issue, C++ (starting with C++11) defines data types and functions to work with time...