* Re: [LTP] nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC
2026-04-16 6:59 [LTP] [PATCH] " Andrea Cervesato
@ 2026-04-16 8:03 ` linuxtestproject.agent
2026-04-16 11:58 ` Petr Vorel
0 siblings, 1 reply; 8+ messages in thread
From: linuxtestproject.agent @ 2026-04-16 8:03 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp
Hi Andrea,
On Thu, 16 Apr 2026 08:59:59 +0200, Andrea Cervesato wrote:
> nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC
> -#include <unistd.h>
> #include <sys/wait.h>
> #include "posixtest.h"
> -
> -#ifdef _POSIX_MONOTONIC_CLOCK
> -#define TEST_CLOCK CLOCK_MONOTONIC
> -#else
> -#define TEST_CLOCK CLOCK_REALTIME
> -#endif
> +#include "helpers.h"
This applies to 1-2.c, 1-3.c, 3-2.c, and 7-2.c. These files call
fork() and sleep() — both declared in <unistd.h> — but the explicit
#include <unistd.h> is removed and now only arrives transitively via
helpers.h. Each file should include the headers it directly uses;
please keep #include <unistd.h> in these four files.
---
Note:
Our agent completed the review of the patch. The agent can sometimes
produce false positives although often its findings are genuine. If
you find issues with the review, please comment this email or ignore
the suggestions.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC
2026-04-16 8:03 ` [LTP] " linuxtestproject.agent
@ 2026-04-16 11:58 ` Petr Vorel
2026-04-16 12:04 ` Andrea Cervesato via ltp
0 siblings, 1 reply; 8+ messages in thread
From: Petr Vorel @ 2026-04-16 11:58 UTC (permalink / raw)
To: linuxtestproject.agent; +Cc: ltp
> Hi Andrea,
> On Thu, 16 Apr 2026 08:59:59 +0200, Andrea Cervesato wrote:
> > nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC
> > -#include <unistd.h>
> > #include <sys/wait.h>
> > #include "posixtest.h"
> > -
> > -#ifdef _POSIX_MONOTONIC_CLOCK
> > -#define TEST_CLOCK CLOCK_MONOTONIC
> > -#else
> > -#define TEST_CLOCK CLOCK_REALTIME
> > -#endif
> > +#include "helpers.h"
> This applies to 1-2.c, 1-3.c, 3-2.c, and 7-2.c. These files call
> fork() and sleep() — both declared in <unistd.h> — but the explicit
> #include <unistd.h> is removed and now only arrives transitively via
> helpers.h. Each file should include the headers it directly uses;
> please keep #include <unistd.h> in these four files.
Hm, we happily use indirect includes in non-openPOSIX tests
(in testcases/kernel/syscalls/). It certainly does not harm to include
<unistd.h> on each place which uses _POSIX_MONOTONIC_CLOCK.
I'd hope agent would find other '#ifdef _POSIX_MONOTONIC_CLOCK' use without
<unistd.h> which is in
testcases/open_posix_testsuite/conformance/interfaces/clock_settime/helpers.h
Kind regards,
Petr
> ---
> Note:
> Our agent completed the review of the patch. The agent can sometimes
> produce false positives although often its findings are genuine. If
> you find issues with the review, please comment this email or ignore
> the suggestions.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC
2026-04-16 11:58 ` Petr Vorel
@ 2026-04-16 12:04 ` Andrea Cervesato via ltp
0 siblings, 0 replies; 8+ messages in thread
From: Andrea Cervesato via ltp @ 2026-04-16 12:04 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp, linuxtestproject.agent
Hi Petr,
> I'd hope agent would find other '#ifdef _POSIX_MONOTONIC_CLOCK' use without
> <unistd.h> which is in
> testcases/open_posix_testsuite/conformance/interfaces/clock_settime/helpers.h
It's one rule behind to make agent discovering this. There's no rule
in the actually c-tests.md agent configuration about this particular
case. I personally never add any include to the file if it's imported
already from other headers.
But we know that everyone has their own opiinon when it comes to C :-)
Should we add a rule to the agent spotting/ignoring these corner cases?
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC
2026-04-16 12:33 [LTP] [PATCH v2] " Andrea Cervesato
@ 2026-04-16 13:45 ` linuxtestproject.agent
0 siblings, 0 replies; 8+ messages in thread
From: linuxtestproject.agent @ 2026-04-16 13:45 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp, LTP AI Reviewer
Hi Andrea,
On 2026-04-16, Andrea Cervesato wrote:
> nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC
> +static inline clockid_t get_supported_clock(void)
> +{
> +#ifdef _POSIX_MONOTONIC_CLOCK
> + if (_POSIX_MONOTONIC_CLOCK > 0)
> + return CLOCK_MONOTONIC;
> +
> + if (!_POSIX_MONOTONIC_CLOCK && sysconf(_SC_MONOTONIC_CLOCK) > 0)
> + return CLOCK_MONOTONIC;
> +#endif
> +
> + printf("CLOCK_MONOTONIC unavailable, test may fail due to "
> + "external clock adjustments\n");
> + return CLOCK_REALTIME;
> +}
Correct POSIX runtime detection — handles all three _POSIX_MONOTONIC_CLOCK
states (>0, ==0, undefined) properly, and the unistd.h include in helpers.h
closes the silent fallback that affected 1-1.c, 2-1.c, and 10000-1.c.
Reviewed-by: LTP AI Reviewer <ltp-ai@noreply.github.com>
---
Note:
Our agent completed the review of the patch.
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC
@ 2026-05-04 13:20 Andrea Cervesato
2026-05-04 14:05 ` [LTP] " linuxtestproject.agent
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Andrea Cervesato @ 2026-05-04 13:20 UTC (permalink / raw)
To: Linux Test Project
From: Andrea Cervesato <andrea.cervesato@suse.com>
The compile-time #ifdef _POSIX_MONOTONIC_CLOCK check was incorrect:
three tests did not include <unistd.h> so the macro was never defined,
and on Linux/glibc it is set to 0 which requires a runtime sysconf()
check. This caused tests to silently fall back to CLOCK_REALTIME,
leading to sporadic failures when NTP or VM time sync adjusted the
wall clock during sleep.
Add pts_get_clock() to clock.h and use it in all nanosleep tests
to perform proper POSIX runtime detection via sysconf().
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
.../conformance/interfaces/nanosleep/1-1.c | 16 ++++------------
.../conformance/interfaces/nanosleep/1-2.c | 16 ++++------------
.../conformance/interfaces/nanosleep/1-3.c | 16 ++++------------
.../conformance/interfaces/nanosleep/10000-1.c | 16 ++++------------
.../conformance/interfaces/nanosleep/2-1.c | 16 ++++------------
.../conformance/interfaces/nanosleep/3-2.c | 16 ++++------------
.../conformance/interfaces/nanosleep/7-2.c | 16 ++++------------
testcases/open_posix_testsuite/include/clock.h | 9 +++++++++
8 files changed, 37 insertions(+), 84 deletions(-)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-1.c
index 0f417715bf0a85e926eb9f1e0cf5cf5e9f172547..9d390e3206867b5555eade5a832d832e73c2a11d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-1.c
@@ -11,24 +11,16 @@
#include <stdio.h>
#include <time.h>
#include "posixtest.h"
-
-#ifdef _POSIX_MONOTONIC_CLOCK
-#define TEST_CLOCK CLOCK_MONOTONIC
-#else
-#define TEST_CLOCK CLOCK_REALTIME
-#endif
+#include "clock.h"
int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
{
struct timespec tssleepfor, tsstorage, tsbefore, tsafter;
int sleepnsec = 3;
int slepts = 0, sleptns = 0;
+ clockid_t test_clock = pts_get_clock();
-#ifndef _POSIX_MONOTONIC_CLOCK
- printf("CLOCK_MONOTONIC unavailable, test may fail due to external clock adjustments\n");
-#endif
-
- if (clock_gettime(TEST_CLOCK, &tsbefore) == -1) {
+ if (clock_gettime(test_clock, &tsbefore) == -1) {
perror("Error in clock_gettime()\n");
return PTS_UNRESOLVED;
}
@@ -40,7 +32,7 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
return PTS_UNRESOLVED;
}
- if (clock_gettime(TEST_CLOCK, &tsafter) == -1) {
+ if (clock_gettime(test_clock, &tsafter) == -1) {
perror("Error in clock_gettime()\n");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-2.c
index 44697324aae218a0b67c32c69e01e01151478ff2..0d608d5127ea0dea5e64ab2b801bc1a5f05965f1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-2.c
@@ -14,24 +14,16 @@
#include <unistd.h>
#include <sys/wait.h>
#include "posixtest.h"
-
-#ifdef _POSIX_MONOTONIC_CLOCK
-#define TEST_CLOCK CLOCK_MONOTONIC
-#else
-#define TEST_CLOCK CLOCK_REALTIME
-#endif
+#include "clock.h"
int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
{
struct timespec tssleepfor, tsstorage, tsbefore, tsafter;
int sleepsec = 30;
int pid;
+ clockid_t test_clock = pts_get_clock();
-#ifndef _POSIX_MONOTONIC_CLOCK
- printf("CLOCK_MONOTONIC unavailable, test may fail due to external clock adjustments\n");
-#endif
-
- if (clock_gettime(TEST_CLOCK, &tsbefore) == -1) {
+ if (clock_gettime(test_clock, &tsbefore) == -1) {
perror("Error in clock_gettime()\n");
return PTS_UNRESOLVED;
}
@@ -56,7 +48,7 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
perror("Error waiting for child to exit\n");
return PTS_UNRESOLVED;
}
- if (clock_gettime(TEST_CLOCK, &tsafter) == -1) {
+ if (clock_gettime(test_clock, &tsafter) == -1) {
perror("Error in clock_gettime()\n");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-3.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-3.c
index 71a289552227086d5869c4dd8fbe2a5e0697fb61..a7ee7e02616bb412837700c60148fa89756ec48a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-3.c
@@ -15,12 +15,7 @@
#include <unistd.h>
#include <sys/wait.h>
#include "posixtest.h"
-
-#ifdef _POSIX_MONOTONIC_CLOCK
-#define TEST_CLOCK CLOCK_MONOTONIC
-#else
-#define TEST_CLOCK CLOCK_REALTIME
-#endif
+#include "clock.h"
static void handler(int signo PTS_ATTRIBUTE_UNUSED)
{
@@ -33,12 +28,9 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
int sleepsec = 30;
int pid;
struct sigaction act;
+ clockid_t test_clock = pts_get_clock();
-#ifndef _POSIX_MONOTONIC_CLOCK
- printf("CLOCK_MONOTONIC unavailable, test may fail due to external clock adjustments\n");
-#endif
-
- if (clock_gettime(TEST_CLOCK, &tsbefore) == -1) {
+ if (clock_gettime(test_clock, &tsbefore) == -1) {
perror("Error in clock_gettime()\n");
return PTS_UNRESOLVED;
}
@@ -74,7 +66,7 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
perror("Error waiting for child to exit\n");
return PTS_UNRESOLVED;
}
- if (clock_gettime(TEST_CLOCK, &tsafter) == -1) {
+ if (clock_gettime(test_clock, &tsafter) == -1) {
perror("Error in clock_gettime()\n");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/10000-1.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/10000-1.c
index e0575029fadd1828fd083ec43b0b96577cd85342..36cf5b90948fb59111f457d2a048f7b47d5df320 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/10000-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/10000-1.c
@@ -18,12 +18,7 @@
#include <time.h>
#include <errno.h>
#include "posixtest.h"
-
-#ifdef _POSIX_MONOTONIC_CLOCK
-#define TEST_CLOCK CLOCK_MONOTONIC
-#else
-#define TEST_CLOCK CLOCK_REALTIME
-#endif
+#include "clock.h"
#define NUMVALID 6
#define NUMINVALID 7
@@ -56,23 +51,20 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
int i;
int failure = 0;
int slepts = 0, sleptns = 0;
-
-#ifndef _POSIX_MONOTONIC_CLOCK
- printf("CLOCK_MONOTONIC unavailable, test may fail due to external clock adjustments\n");
-#endif
+ clockid_t test_clock = pts_get_clock();
for (i = 0; i < NUMVALID; i++) {
tssleepfor.tv_sec = sleepvalid[i][0];
tssleepfor.tv_nsec = sleepvalid[i][1];
printf("sleep %d sec %d nsec\n",
(int)tssleepfor.tv_sec, (int)tssleepfor.tv_nsec);
- if (clock_gettime(TEST_CLOCK, &tsbefore) == -1) {
+ if (clock_gettime(test_clock, &tsbefore) == -1) {
perror("Error in clock_gettime()\n");
return PTS_UNRESOLVED;
}
if (nanosleep(&tssleepfor, &tsstorage) == 0) {
- if (clock_gettime(TEST_CLOCK, &tsafter) == -1) {
+ if (clock_gettime(test_clock, &tsafter) == -1) {
perror("Error in clock_gettime()\n");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/2-1.c
index d3eb514b5e7ef2382b1a93909f884cee0acb6b0b..82cf275066aa7b0c354b5633b41c8983873250e9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/2-1.c
@@ -12,12 +12,7 @@
#include <stdio.h>
#include <time.h>
#include "posixtest.h"
-
-#ifdef _POSIX_MONOTONIC_CLOCK
-#define TEST_CLOCK CLOCK_MONOTONIC
-#else
-#define TEST_CLOCK CLOCK_REALTIME
-#endif
+#include "clock.h"
#define NUMINTERVALS 13
int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
@@ -30,12 +25,9 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
int i;
int failure = 0;
int slepts, sleptns;
+ clockid_t test_clock = pts_get_clock();
-#ifndef _POSIX_MONOTONIC_CLOCK
- printf("CLOCK_MONOTONIC unavailable, test may fail due to external clock adjustments\n");
-#endif
-
- if (clock_gettime(TEST_CLOCK, &tsbefore) == -1) {
+ if (clock_gettime(test_clock, &tsbefore) == -1) {
perror("Error in clock_gettime()\n");
return PTS_UNRESOLVED;
}
@@ -48,7 +40,7 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
return PTS_UNRESOLVED;
}
- if (clock_gettime(TEST_CLOCK, &tsafter) == -1) {
+ if (clock_gettime(test_clock, &tsafter) == -1) {
perror("Error in clock_gettime()\n");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/3-2.c
index 15fb7cd7cbece7ed352a74e56fde2161bbde060d..8f366d9dd16998d899291cf220296dfb6cdfb9a4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/3-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/3-2.c
@@ -15,12 +15,7 @@
#include <sys/wait.h>
#include <stdlib.h>
#include "posixtest.h"
-
-#ifdef _POSIX_MONOTONIC_CLOCK
-#define TEST_CLOCK CLOCK_MONOTONIC
-#else
-#define TEST_CLOCK CLOCK_REALTIME
-#endif
+#include "clock.h"
#define SLEEPSEC 5
@@ -31,12 +26,9 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
{
int pid, slepts;
struct timespec tsbefore, tsafter;
+ clockid_t test_clock = pts_get_clock();
-#ifndef _POSIX_MONOTONIC_CLOCK
- printf("CLOCK_MONOTONIC unavailable, test may fail due to external clock adjustments\n");
-#endif
-
- if (clock_gettime(TEST_CLOCK, &tsbefore) != 0) {
+ if (clock_gettime(test_clock, &tsbefore) != 0) {
perror("clock_gettime() did not return success\n");
return PTS_UNRESOLVED;
}
@@ -84,7 +76,7 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
return PTS_FAIL;
}
- if (clock_gettime(TEST_CLOCK, &tsafter) == -1) {
+ if (clock_gettime(test_clock, &tsafter) == -1) {
perror("Error in clock_gettime()\n");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-2.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-2.c
index 58698b459defc9746b5acbdd6f9ca366a3668ccb..59ca2d2583f6ff4aca16451e7895b431a5d0d664 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-2.c
@@ -16,12 +16,7 @@
#include <sys/wait.h>
#include <stdlib.h>
#include "posixtest.h"
-
-#ifdef _POSIX_MONOTONIC_CLOCK
-#define TEST_CLOCK CLOCK_MONOTONIC
-#else
-#define TEST_CLOCK CLOCK_REALTIME
-#endif
+#include "clock.h"
#define CHILDSUCCESS 1
#define CHILDFAILURE 0
@@ -39,12 +34,9 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
int sleepsec = 30;
int pid;
struct sigaction act;
+ clockid_t test_clock = pts_get_clock();
-#ifndef _POSIX_MONOTONIC_CLOCK
- printf("CLOCK_MONOTONIC unavailable, test may fail due to external clock adjustments\n");
-#endif
-
- if (clock_gettime(TEST_CLOCK, &tsbefore) == -1) {
+ if (clock_gettime(test_clock, &tsbefore) == -1) {
perror("Error in clock_gettime()\n");
return PTS_UNRESOLVED;
}
@@ -70,7 +62,7 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
return CHILDFAILURE;
}
- if (clock_gettime(TEST_CLOCK, &tsafter) == -1) {
+ if (clock_gettime(test_clock, &tsafter) == -1) {
perror("Error in clock_gettime()\n");
return CHILDFAILURE;
}
diff --git a/testcases/open_posix_testsuite/include/clock.h b/testcases/open_posix_testsuite/include/clock.h
index 11c7e949fa4b9b9ba1473b6bd4b54ba70c5ff63c..0073db2c73e575ee537375e7cb571f5a98e14448 100644
--- a/testcases/open_posix_testsuite/include/clock.h
+++ b/testcases/open_posix_testsuite/include/clock.h
@@ -23,6 +23,15 @@ static inline int pts_mono_available(void)
return 0;
}
+static inline clockid_t pts_get_clock(void)
+{
+ if (pts_mono_available())
+ return CLOCK_MONOTONIC;
+
+ printf("CLOCK_MONOTONIC unavailable, test may fail due to clock adjustment\n");
+ return CLOCK_REALTIME;
+}
+
#define PTS_MONO_MAX_RETRIES 3
static struct timespec pts_mono_start;
---
base-commit: 1ad07fa36483b27c781cad63f346e91986b3ac15
change-id: 20260504-fix_nanosleep_pts_get_clock-e6bd186b5f40
Best regards,
--
Andrea Cervesato <andrea.cervesato@suse.com>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [LTP] nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC
2026-05-04 13:20 [LTP] [PATCH] nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC Andrea Cervesato
@ 2026-05-04 14:05 ` linuxtestproject.agent
2026-05-05 14:29 ` [LTP] [PATCH] " Cyril Hrubis
2026-05-05 14:32 ` Andrea Cervesato via ltp
2 siblings, 0 replies; 8+ messages in thread
From: linuxtestproject.agent @ 2026-05-04 14:05 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp, LTP AI Reviewer
Hi Andrea,
On Mon, 4 May 2026 15:20:18 +0200, Andrea Cervesato wrote:
> nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC
> +static inline clockid_t pts_get_clock(void)
> +{
> + if (pts_mono_available())
> + return CLOCK_MONOTONIC;
> +
> + printf("CLOCK_MONOTONIC unavailable, test may fail due to clock adjustment\n");
> + return CLOCK_REALTIME;
> +}
Clean fix. Centralising the runtime detection into pts_get_clock() is the
right approach and correctly handles the Linux/glibc case where
_POSIX_MONOTONIC_CLOCK == 0 requires a sysconf() check.
Reviewed-by: LTP AI Reviewer <ltp-ai@noreply.github.com>
---
Note:
Our agent completed the review of the patch. The full review can be
found at: https://github.com/linux-test-project/ltp-agent/actions/runs/25323299867
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH] nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC
2026-05-04 13:20 [LTP] [PATCH] nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC Andrea Cervesato
2026-05-04 14:05 ` [LTP] " linuxtestproject.agent
@ 2026-05-05 14:29 ` Cyril Hrubis
2026-05-05 14:32 ` Andrea Cervesato via ltp
2 siblings, 0 replies; 8+ messages in thread
From: Cyril Hrubis @ 2026-05-05 14:29 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: Linux Test Project
Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH] nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC
2026-05-04 13:20 [LTP] [PATCH] nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC Andrea Cervesato
2026-05-04 14:05 ` [LTP] " linuxtestproject.agent
2026-05-05 14:29 ` [LTP] [PATCH] " Cyril Hrubis
@ 2026-05-05 14:32 ` Andrea Cervesato via ltp
2 siblings, 0 replies; 8+ messages in thread
From: Andrea Cervesato via ltp @ 2026-05-05 14:32 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: Linux Test Project
Merged, Thanks!
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-05-05 14:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-04 13:20 [LTP] [PATCH] nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC Andrea Cervesato
2026-05-04 14:05 ` [LTP] " linuxtestproject.agent
2026-05-05 14:29 ` [LTP] [PATCH] " Cyril Hrubis
2026-05-05 14:32 ` Andrea Cervesato via ltp
-- strict thread matches above, loose matches on Subject: below --
2026-04-16 12:33 [LTP] [PATCH v2] " Andrea Cervesato
2026-04-16 13:45 ` [LTP] " linuxtestproject.agent
2026-04-16 6:59 [LTP] [PATCH] " Andrea Cervesato
2026-04-16 8:03 ` [LTP] " linuxtestproject.agent
2026-04-16 11:58 ` Petr Vorel
2026-04-16 12:04 ` Andrea Cervesato via ltp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox