[libc-commits] [libc] [libc] Implement `timespec_get` (PR #116102)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Thu Nov 14 08:45:33 PST 2024


================
@@ -0,0 +1,31 @@
+//===-- Implementation of timespec_get for Linux --------------------------===//
+//
+// 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/timespec_get.h"
+#include "hdr/time_macros.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/time/linux/clock_gettime.h"
+#include "src/errno/libc_errno.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(int, timespec_get, (struct timespec * ts, int base)) {
+  if (base != TIME_UTC) {
+    return 0;
+  }
----------------
nickdesaulniers wrote:

Please update this PR to follow https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements throughout.

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


More information about the libc-commits mailing list