vendredi 26 janvier 2018

What's the Difference Between floor and duration_cast?

So in the Chrono Library provides, duration_cast:

Computations are done in the widest type available and converted, as if by static_cast, to the result type only when finished

And 's floor:

Returns the greatest duration t representable in ToDuration that is less or equal to d

So for all x will the result of these 2 calls be equal:

  1. chrono::duration_cast<chrono::seconds>(x)
  2. chrono::floor<chrono::seconds>(x)

Aucun commentaire:

Enregistrer un commentaire