Commit Graph

1 Commits

Author SHA1 Message Date
Wouter Klouwen
ff62b00522 CTest: add safe conversion from cmDuration to integer types
A problem area by recent refactoring of time to std::chrono has been the
unsafe conversion from duration<double> to std::chrono::seconds, which
is of an unspecified integer type.

This commit adds a template function that for a given type provides a
safe conversion, effectively clamping a duration<double> into what fits
safely in that type. A specialisation for int and unsigned int are
provided.

It changes the protential problem areas to use this safe function.
2018-01-23 10:05:12 -05:00