Date and time library
From cppreference.com
< cpp
C++ includes support for two types of time manipulation:
- The chrono library, a flexible collection of types that track time with varying degrees of precision (e.g., std::chrono::time_point).
- C-style date and time library (e.g., std::time).
Contents |
[edit] Chrono library (since C++11)
The chrono
library defines several main types as well as utility functions and common typedefs:
(since C++20) |
[edit] Clocks
A clock consists of a starting point (or epoch) and a tick rate. For example, a clock may have an epoch of January 1, 1970 and tick every second. C++ defines several clock types:
Defined in header
<chrono> | |
Defined in namespace
std::chrono | |
(C++11) |
wall clock time from the system-wide realtime clock (class) |
(C++11) |
monotonic clock that will never be adjusted (class) |
(C++11) |
the clock with the shortest tick period available (class) |
(C++20) |
determines if a type is a Clock (class template) (variable template) |
(C++20) |
Clock for Coordinated Universal Time (UTC) (class) |