Fix build for Unices without CLOCK_MONOTONIC_RAW
authorLiam Middlebrook <lmiddlebrook@nvidia.com>
Wed, 9 Dec 2020 23:17:26 +0000 (15:17 -0800)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 10 Dec 2020 15:28:08 +0000 (10:28 -0500)
CLOCK_MONOTONIC_RAW was introduced in Linux 2.6.28 and glibc 2.12. In
order to build the CTS on non-Linux Unices or older Linux distros we
should only compile-in usage of CLOCK_MONOTONIC_RAW when it is available
at build-time.

Components: Vulkan

VK-GL-CTS issue: 2696

Affects:
dEQP-VK.pipeline.timestamp.calibrated.host_domain_test

Change-Id: I937d4ea6350fe0b70c0028d9ae48b9234e425fdf

external/vulkancts/modules/vulkan/pipeline/vktPipelineTimestampTests.cpp

index 65ea4f0..292ad90 100644 (file)
@@ -1189,10 +1189,10 @@ deUint64 CalibratedTimestampTestInstance::getHostNativeTimestamp (VkTimeDomainEX
        DE_ASSERT(hostDomain == VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT ||
                          hostDomain == VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT);
 
-#if (DE_OS == DE_OS_QNX)
-       clockid_t id = CLOCK_MONOTONIC;
-#else
+#if defined(CLOCK_MONOTONIC_RAW)
        clockid_t id = ((hostDomain == VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT) ? CLOCK_MONOTONIC : CLOCK_MONOTONIC_RAW);
+#else
+       clockid_t id = CLOCK_MONOTONIC;
 #endif
        struct timespec ts;
        if (clock_gettime(id, &ts) != 0)