mercredi 7 octobre 2020

Is it guaranteed that std::chrono::steady_clock never wraps around?

Basically:

auto p1 = steady_clock::now().time_since_epoch().count();

... // do smth for unspecified period of time

auto p2 = steady_clock::now().time_since_epoch().count();

assert(p2 >= p1);   // is this guaranteed?

?

If yes -- how it this guaranteed? By making sure no C++ program ever runs for longer than steady_clock::duration::max() - steady_clock::duration::zero()?

Aucun commentaire:

Enregistrer un commentaire