[libc-commits] [libc] [libc][POSIX] Add clock_settime() function for Linux (PR #161729)
via libc-commits
libc-commits at lists.llvm.org
Fri Oct 3 09:33:16 PDT 2025
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 origin/main HEAD --extensions cpp,h -- libc/src/__support/time/clock_settime.h libc/src/__support/time/linux/clock_settime.cpp libc/src/time/clock_settime.h libc/src/time/linux/clock_settime.cpp libc/test/src/time/clock_settime_test.cpp libc/src/time/linux/clock.cpp libc/src/time/linux/clock_gettime.cpp libc/src/time/linux/nanosleep.cpp libc/src/time/linux/timespec_get.cpp
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libc/src/time/linux/clock_gettime.cpp b/libc/src/time/linux/clock_gettime.cpp
index a77d92e05..52ace2a74 100644
--- a/libc/src/time/linux/clock_gettime.cpp
+++ b/libc/src/time/linux/clock_gettime.cpp
@@ -15,8 +15,7 @@
namespace LIBC_NAMESPACE_DECL {
// TODO(michaelrj): Move this into time/linux with the other syscalls.
-LLVM_LIBC_FUNCTION(int, clock_gettime,
- (clockid_t clockid, timespec *ts)) {
+LLVM_LIBC_FUNCTION(int, clock_gettime, (clockid_t clockid, timespec *ts)) {
auto result = internal::clock_gettime(clockid, ts);
// A negative return value indicates an error with the magnitude of the
diff --git a/libc/src/time/linux/nanosleep.cpp b/libc/src/time/linux/nanosleep.cpp
index 7b0a4a3ef..a30b97de4 100644
--- a/libc/src/time/linux/nanosleep.cpp
+++ b/libc/src/time/linux/nanosleep.cpp
@@ -18,8 +18,7 @@
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(int, nanosleep,
- (const timespec *req, timespec *rem)) {
+LLVM_LIBC_FUNCTION(int, nanosleep, (const timespec *req, timespec *rem)) {
#if SYS_nanosleep
int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_nanosleep, req, rem);
#elif defined(SYS_clock_nanosleep_time64)
diff --git a/libc/src/time/linux/timespec_get.cpp b/libc/src/time/linux/timespec_get.cpp
index e90f492b6..031cb9f83 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, (timespec *ts, int base)) {
+LLVM_LIBC_FUNCTION(int, timespec_get, (timespec * ts, int base)) {
clockid_t clockid;
switch (base) {
case TIME_UTC:
``````````
</details>
https://github.com/llvm/llvm-project/pull/161729
More information about the libc-commits
mailing list