Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 4,103
    • Issues 4,103
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 18
    • Merge requests 18
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMakeCMake
  • CMakeCMake
  • Issues
  • #17345
Closed
Open
Issue created Oct 10, 2017 by dublet@dubletContributor

CTest doesn't use monotonic times leading to timeouts if device time changes

Hi,

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

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(), such a test would seem to have taken 17 years. It's generally preferred in such cases to use clock_gettime(CLOCK_MONOTONIC) instead.

We've found at least two instances in the CTest code base, and an attached is a patch to change kwsysProcessTimeGetCurrent() and SystemTools::GetTime() to use clock_gettime() in order to use monotonic timers.

Do these changes make sense?

0001-Use-monotonic-timers-where-gettimeofday-was-used-to-.patch

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking