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

via libc-commits libc-commits at lists.llvm.org
Wed Nov 13 12:21:56 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 39b2979a434e70a4ce76d4adf91572dcfc9662ff f0f442df54468a7f6af36aa94482e4491eff148c --extensions cpp,h -- libc/src/__support/OSUtil/baremetal/time.cpp libc/src/__support/OSUtil/baremetal/time.h libc/src/time/baremetal/timespec_get.cpp libc/src/time/linux/timespec_get.cpp libc/src/time/timespec_get.h libc/test/src/time/timespec_get_test.cpp libc/include/llvm-libc-macros/time-macros.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/src/__support/OSUtil/baremetal/time.cpp b/libc/src/__support/OSUtil/baremetal/time.cpp
index 63f0624b4c..e4cb6eafc6 100644
--- a/libc/src/__support/OSUtil/baremetal/time.cpp
+++ b/libc/src/__support/OSUtil/baremetal/time.cpp
@@ -14,8 +14,6 @@ namespace LIBC_NAMESPACE_DECL {
 
 extern "C" int __llvm_libc_time_utc_get(struct timespec *ts);
 
-int time_utc_get(struct timespec *ts) {
-  return __llvm_libc_time_utc_get(ts);
-}
+int time_utc_get(struct timespec *ts) { return __llvm_libc_time_utc_get(ts); }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/time/baremetal/timespec_get.cpp b/libc/src/time/baremetal/timespec_get.cpp
index 93ae4e9c9d..3c3be8f2d1 100644
--- a/libc/src/time/baremetal/timespec_get.cpp
+++ b/libc/src/time/baremetal/timespec_get.cpp
@@ -8,13 +8,13 @@
 
 #include "src/time/timespec_get.h"
 #include "hdr/time_macros.h"
+#include "src/__support/OSUtil/baremetal/time.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
-#include "src/__support/OSUtil/baremetal/time.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
-LLVM_LIBC_FUNCTION(int, timespec_get, (struct timespec *ts, int base)) {
+LLVM_LIBC_FUNCTION(int, timespec_get, (struct timespec * ts, int base)) {
   if (base != TIME_UTC) {
     return 0;
   }
diff --git a/libc/src/time/linux/timespec_get.cpp b/libc/src/time/linux/timespec_get.cpp
index fa236cd3ea..88de72c657 100644
--- a/libc/src/time/linux/timespec_get.cpp
+++ b/libc/src/time/linux/timespec_get.cpp
@@ -15,7 +15,7 @@
 
 namespace LIBC_NAMESPACE_DECL {
 
-LLVM_LIBC_FUNCTION(int, timespec_get, (struct timespec *ts, int base)) {
+LLVM_LIBC_FUNCTION(int, timespec_get, (struct timespec * ts, int base)) {
   if (base != TIME_UTC) {
     return 0;
   }
diff --git a/libc/src/time/timespec_get.h b/libc/src/time/timespec_get.h
index 32ba159a94..c583550bfb 100644
--- a/libc/src/time/timespec_get.h
+++ b/libc/src/time/timespec_get.h
@@ -1,4 +1,5 @@
-//===-- Implementation header of timespec_get --------------------*- C++ -*-===//
+//===-- Implementation header of timespec_get --------------------*- C++
+//-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.

``````````

</details>


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


More information about the libc-commits mailing list