diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt index e3ebd3ca47256..28317c656d4be 100644 --- a/libc/config/gpu/entrypoints.txt +++ b/libc/config/gpu/entrypoints.txt @@ -257,6 +257,7 @@ set(TARGET_LIBC_ENTRYPOINTS # time.h entrypoints libc.src.time.clock libc.src.time.clock_gettime + libc.src.time.timespec_get libc.src.time.nanosleep # wchar.h entrypoints diff --git a/libc/src/__support/time/gpu/time_utils.h b/libc/src/__support/time/gpu/time_utils.h index c631a38d91ba2..315506c897dcf 100644 --- a/libc/src/__support/time/gpu/time_utils.h +++ b/libc/src/__support/time/gpu/time_utils.h @@ -38,6 +38,8 @@ extern gpu::Constant __llvm_libc_clock_freq; #error "Unsupported target" #endif +constexpr uint64_t TICKS_PER_SEC = 1000000000UL; + } // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_TIME_GPU_TIME_UTILS_H diff --git a/libc/src/time/gpu/nanosleep.cpp b/libc/src/time/gpu/nanosleep.cpp index 25a22d5703fa7..a92f660f225cb 100644 --- a/libc/src/time/gpu/nanosleep.cpp +++ b/libc/src/time/gpu/nanosleep.cpp @@ -13,8 +13,6 @@ namespace LIBC_NAMESPACE_DECL { -constexpr uint64_t TICKS_PER_SEC = 1000000000UL; - LLVM_LIBC_FUNCTION(int, nanosleep, (const struct timespec *req, struct timespec *rem)) { if (!GPU_CLOCKS_PER_SEC || !req) diff --git a/libc/src/time/gpu/timespec_get.cpp b/libc/src/time/gpu/timespec_get.cpp index f4ef328a83122..0dd128444aa8e 100644 --- a/libc/src/time/gpu/timespec_get.cpp +++ b/libc/src/time/gpu/timespec_get.cpp @@ -10,6 +10,7 @@ #include "hdr/time_macros.h" #include "src/__support/common.h" #include "src/__support/macros/config.h" +#include "src/__support/time/gpu/time_utils.h" namespace LIBC_NAMESPACE_DECL {