The C ++ standard does not say much about time. There are several functions inherited from C through the <ctime> header.
The clock function is the only way to get accuracy for the second second, but the accuracy can reach one second (it is determined by the CLOCKS_PER_SEC macro). In addition, it does not measure real time at all, but rather processor time.
The time function measures real time, but (usually) only until the next second.
To measure real time accurate to the second, you need a custom library.
Potatoswatter
source share