[libc-commits] [libc] ce3bade - [libc] Fix call to clock_gettime (#65166)

via libc-commits libc-commits at lists.llvm.org
Wed Sep 6 11:26:23 PDT 2023


Author: Mikhail R. Gadelha
Date: 2023-09-06T14:26:20-04:00
New Revision: ce3bade0cfc8e44e49c74e2f99fd13587ff79701

URL: https://github.com/llvm/llvm-project/commit/ce3bade0cfc8e44e49c74e2f99fd13587ff79701
DIFF: https://github.com/llvm/llvm-project/commit/ce3bade0cfc8e44e49c74e2f99fd13587ff79701.diff

LOG: [libc] Fix call to clock_gettime (#65166)

The calls were missing the __llvm_libc:: namespace, which can allow the
test case to be linked to glibc's clock_gettime.

Added: 
    

Modified: 
    libc/test/src/time/clock_gettime_test.cpp

Removed: 
    


################################################################################
diff  --git a/libc/test/src/time/clock_gettime_test.cpp b/libc/test/src/time/clock_gettime_test.cpp
index 6bea4ab539af167..58f9c61129d2061 100644
--- a/libc/test/src/time/clock_gettime_test.cpp
+++ b/libc/test/src/time/clock_gettime_test.cpp
@@ -14,7 +14,7 @@
 TEST(LlvmLibcClockGetTime, RealTime) {
   struct timespec tp;
   int result;
-  result = clock_gettime(CLOCK_REALTIME, &tp);
+  result = __llvm_libc::clock_gettime(CLOCK_REALTIME, &tp);
   ASSERT_EQ(result, 0);
   ASSERT_GT(tp.tv_sec, time_t(0));
 }
@@ -23,10 +23,10 @@ TEST(LlvmLibcClockGetTime, RealTime) {
 TEST(LlvmLibcClockGetTime, MonotonicTime) {
   struct timespec tp1, tp2;
   int result;
-  result = clock_gettime(CLOCK_MONOTONIC, &tp1);
+  result = __llvm_libc::clock_gettime(CLOCK_MONOTONIC, &tp1);
   ASSERT_EQ(result, 0);
   ASSERT_GT(tp1.tv_sec, time_t(0));
-  result = clock_gettime(CLOCK_MONOTONIC, &tp2);
+  result = __llvm_libc::clock_gettime(CLOCK_MONOTONIC, &tp2);
   ASSERT_EQ(result, 0);
   ASSERT_GE(tp2.tv_sec, tp1.tv_sec); // The monotonic clock should increase.
   if (tp2.tv_sec == tp1.tv_sec) {


        


More information about the libc-commits mailing list