[libc-commits] [libc] [libc] Baremetal version of clock (PR #146417)
Petr Hosek via libc-commits
libc-commits at lists.llvm.org
Fri Jul 11 12:35:18 PDT 2025
================
@@ -0,0 +1,45 @@
+//===-- Baremetal implementation of the clock 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.h"
+#include "hdr/time_macros.h"
+#include "hdr/types/struct_timespec.h"
+#include "src/__support/CPP/limits.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/time/units.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+extern "C" bool __llvm_libc_timespec_get_active(struct timespec *ts);
----------------
petrhosek wrote:
I agree that this approach requires potentially more code on the embedder side, but I want to avoid overfitting the embedder interface to semihosting. The reason I introduced the `__llvm_libc_timespec_get_active` as opposed to `__llvm_libc_clock` is that I'd also like to use it to implement `TIME_ACTIVE` version of `timespec_get` keeping the surface as small as possible.
https://github.com/llvm/llvm-project/pull/146417
More information about the libc-commits
mailing list