[libc-commits] [libc] [libc] Implement `clock_gettime` for the monotonic clock on the GPU (PR #99067)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Tue Jul 16 12:50:25 PDT 2024


================
@@ -0,0 +1,33 @@
+//===---------- GPU implementation of the POSIX clock_gettime function ----===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/time/clock_gettime.h"
+
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+#include "time_utils.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+constexpr uint64_t TICKS_PER_SEC = 1000000000UL;
+
+LLVM_LIBC_FUNCTION(int, clock_gettime,
+                   (clockid_t clockid, struct timespec *ts)) {
----------------
jhuber6 wrote:

```suggestion
                   (clockid_t clockid, timespec *ts)) {
```

https://github.com/llvm/llvm-project/pull/99067


More information about the libc-commits mailing list