Clock
Here, we briefly discuss the different types of clocks in C++.
The clock consists of a starting point and a tick. So you can get the current time with the method now
.
-
std::chrono::system_clock
:
System time, which you can synchronize with the external clock. -
std::chrono::steady_clock
:
Clock, which can not be adjusted. -
std::chrono::high_resolution_clock
:
System time with the greatest accuracy.
std::chrono::system_clock
will refer typically to the 1.1.1970. You can not adjust std::steady_clock
forward or backward in opposite to two other clocks. The methods to_time_t
and from_time_t
can be used to convert between std::chrono::system_clock
and std::time_t
objects.