/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #define CMDURATION_CPP #include "cmDuration.h" template T cmDurationTo(const cmDuration& duration) { /* This works because the comparison operators for duration rely on * std::common_type. * So for example duration::max() gets promoted to a duration, * which can then be safely compared. */ if (duration >= std::chrono::duration::max()) { return std::chrono::duration::max().count(); } if (duration <= std::chrono::duration::min()) { return std::chrono::duration::min().count(); } // Ensure number of seconds by defining ratio<1> return std::chrono::duration_cast>>( duration) .count(); } template int cmDurationTo(const cmDuration&); template unsigned int cmDurationTo(const cmDuration&);