[compiler-rt santizer] Use clock_gettime instead of timespec_get
authorJeroen Dobbelaere <jeroen.dobbelaere@synopsys.com>
Tue, 8 Dec 2020 16:33:14 +0000 (08:33 -0800)
committerTeresa Johnson <tejohnson@google.com>
Tue, 8 Dec 2020 18:10:17 +0000 (10:10 -0800)
On RH66, timespec_get is not available. Use clock_gettime instead.

This problem was introduced with D87120

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D91687

compiler-rt/lib/memprof/memprof_allocator.cpp
compiler-rt/lib/memprof/memprof_rtl.cpp

index 0f9263e..259c7c1 100644 (file)
@@ -52,7 +52,7 @@ static int GetTimestamp(void) {
     return 0;
   }
   timespec ts;
-  timespec_get(&ts, TIME_UTC);
+  clock_gettime(CLOCK_REALTIME, &ts);
   return (ts.tv_sec - memprof_init_timestamp_s) * 1000 + ts.tv_nsec / 1000000;
 }
 
index 8e1335a..d6d606f 100644 (file)
@@ -234,7 +234,7 @@ void MemprofInitTime() {
   if (LIKELY(memprof_timestamp_inited))
     return;
   timespec ts;
-  timespec_get(&ts, TIME_UTC);
+  clock_gettime(CLOCK_REALTIME, &ts);
   memprof_init_timestamp_s = ts.tv_sec;
   memprof_timestamp_inited = 1;
 }