[cmake-developers] Using monotonic time in CMake & CTest

Wouter Klouwen wouter.klouwen at youview.com
Tue Oct 10 10:57:53 EDT 2017

Hi all,

we've started to use CTest for our test running and it's generally
running well.

However, we sometimes get some odd timeouts in tests, and as such it has
been noticed that ctest doesn't use monotonic test timers, but instead
relies on gettimeofday().
When running on some of our devices, they start up thinking that it is
the year 2000 but during the test run, NTP kicks in, and fast forwards
the time to be 2017.

Using gettimeofday(), a test running during this NTP operation would
seem to have taken 17 years.
To avoid this, it's possible to use monotonic timers instead using

Is there any reason to not use this?

I've raised a bug* with a proposed patch.

Thanks in advance,

*: https://gitlab.kitware.com/cmake/cmake/issues/17345
This transmission contains information that may be confidential and contain personal views which are not necessarily those of YouView TV Ltd. YouView TV Ltd (Co No:7308805) is a limited liability company registered in England and Wales with its registered address at YouView TV Ltd, 3rd Floor, 10 Lower Thames Street, London, EC3R 6YT. For details see our web site at http://www.youview.com

More information about the cmake-developers mailing list