From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v2] nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC
Date: Fri, 17 Apr 2026 14:58:21 +0200 [thread overview]
Message-ID: <20260417125821.GB419619@pevik> (raw)
In-Reply-To: <20260416-fix_nanosleep_include-v2-1-b3147763acb8@suse.com>
Hi Andrea,
...
> --- /dev/null
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/helpers.h
> @@ -0,0 +1,28 @@
> +/*
> + * Copyright (c) 2026, Linux Test Project
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#ifndef NANOSLEEP_HELPERS_H
> +#define NANOSLEEP_HELPERS_H
> +
> +#include <stdio.h>
> +#include <unistd.h>
> +#include <time.h>
> +
> +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");
+1 for warning. But please don't split string just due few chars over 100.
> + return CLOCK_REALTIME;
I've suggested [1] in clock_settime [2] to move this function to newly created
testcases/open_posix_testsuite/include/clock.h, so that clock_settime/helpers.h
can also use it.
Kind regards,
Petr
[1] https://lore.kernel.org/ltp/20260417125322.GA419619@pevik/
[2] https://patchwork.ozlabs.org/project/ltp/patch/20260416-fix_clock_settime_helper-v1-1-2874202291bf@suse.com/
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2026-04-17 12:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 12:33 [LTP] [PATCH v2] nanosleep: use POSIX runtime detection for CLOCK_MONOTONIC Andrea Cervesato
2026-04-16 13:45 ` [LTP] " linuxtestproject.agent
2026-04-17 12:58 ` Petr Vorel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260417125821.GB419619@pevik \
--to=pvorel@suse.cz \
--cc=andrea.cervesato@suse.de \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox