Linux Test Project
 help / color / mirror / Atom feed
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] clock_settime: use POSIX runtime detection for CLOCK_MONOTONIC
Date: Wed, 29 Apr 2026 09:53:47 +0200	[thread overview]
Message-ID: <20260429075347.GB968839@pevik> (raw)
In-Reply-To: <20260428-fix_clock_settime_helper-v2-1-26cce3b7d706@suse.com>

Hi Andrea,

> +#include <unistd.h>
> +#include "clock.h"

>  static int getBeforeTime(struct timespec *tpget)
>  {
> @@ -37,53 +42,53 @@ static int setBackTime(struct timespec tpset)

>  #define PTS_MONO_MAX_RETRIES 3

> -#ifdef _POSIX_MONOTONIC_CLOCK
> -static struct timespec _pts_mono_start;
> +static struct timespec pts_mono_start;

>  static inline int pts_mono_time_start(void)
>  {
> -	if (clock_gettime(CLOCK_MONOTONIC, &_pts_mono_start) != 0) {
> +	if (!pts_mono_available()) {
> +		static int warned;
> +
> +		if (!warned) {
> +			printf("CLOCK_MONOTONIC unavailable, test may fail due to clock adjustment\n");
> +			warned = 1;
> +		}
Function with this warning could be in include/clock.h as well, because that
will be needed for nanosleep tests. But you can postpone it to nanosleep
changes.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

> +		return 0;
> +	}
...

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2026-04-29  7:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 12:24 [LTP] [PATCH v2] clock_settime: use POSIX runtime detection for CLOCK_MONOTONIC Andrea Cervesato
2026-04-28 14:42 ` [LTP] " linuxtestproject.agent
2026-04-29  7:22   ` Andrea Cervesato via ltp
2026-04-29  8:04     ` Petr Vorel
2026-04-29  8:13       ` Andrea Cervesato via ltp
2026-04-29  7:53 ` Petr Vorel [this message]
2026-04-29  7:59   ` [LTP] [PATCH v2] " Andrea Cervesato via ltp

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=20260429075347.GB968839@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