Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2230105/?format=api
{ "id": 2230105, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2230105/?format=api", "web_url": "http://patchwork.ozlabs.org/project/ltp/patch/20260429-fix_clock_settime_helper-v3-1-2608c39d8499@suse.com/", "project": { "id": 59, "url": "http://patchwork.ozlabs.org/api/1.1/projects/59/?format=api", "name": "Linux Test Project development", "link_name": "ltp", "list_id": "ltp.lists.linux.it", "list_email": "ltp@lists.linux.it", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260429-fix_clock_settime_helper-v3-1-2608c39d8499@suse.com>", "date": "2026-04-29T08:28:35", "name": "[v3] clock_settime: use POSIX runtime detection for CLOCK_MONOTONIC", "commit_ref": null, "pull_url": null, "state": "needs-review-ack", "archived": false, "hash": "17d2e2ba8299cab0a24050486933ad454b8c53f2", "submitter": { "id": 83220, "url": "http://patchwork.ozlabs.org/api/1.1/people/83220/?format=api", "name": "Andrea Cervesato", "email": "andrea.cervesato@suse.de" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/ltp/patch/20260429-fix_clock_settime_helper-v3-1-2608c39d8499@suse.com/mbox/", "series": [ { "id": 502017, "url": "http://patchwork.ozlabs.org/api/1.1/series/502017/?format=api", "web_url": "http://patchwork.ozlabs.org/project/ltp/list/?series=502017", "date": "2026-04-29T08:28:35", "name": "[v3] clock_settime: use POSIX runtime detection for CLOCK_MONOTONIC", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/502017/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2230105/comments/", "check": "warning", "checks": "http://patchwork.ozlabs.org/api/patches/2230105/checks/", "tags": {}, "headers": { "Return-Path": "<ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "ltp@lists.linux.it" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "ltp@picard.linux.it" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=Bu0VURgY;\n\tdkim=fail reason=\"signature verification failed\" header.d=suse.de\n header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519\n header.b=AQn1X7ov;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa\n header.b=Bu0VURgY;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=AQn1X7ov;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it\n (client-ip=2001:1418:10:5::2; helo=picard.linux.it;\n envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it;\n receiver=patchwork.ozlabs.org)", "smtp-out2.suse.de;\n\tnone" ], "Received": [ "from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g59SJ1tKVz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 18:28:46 +1000 (AEST)", "from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id 4103F3E289F\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 10:28:44 +0200 (CEST)", "from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it\n [IPv6:2001:4b78:1:20::4])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature ECDSA (secp384r1))\n (No client certificate requested)\n by picard.linux.it (Postfix) with ESMTPS id 83D693D7220\n for <ltp@lists.linux.it>; Wed, 29 Apr 2026 10:28:38 +0200 (CEST)", "from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 055351000A27\n for <ltp@lists.linux.it>; Wed, 29 Apr 2026 10:28:37 +0200 (CEST)", "from imap1.dmz-prg2.suse.org (unknown [10.150.64.97])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-out2.suse.de (Postfix) with ESMTPS id 4B50E5BD55;\n Wed, 29 Apr 2026 08:28:37 +0000 (UTC)", "from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 29DDC593B0;\n Wed, 29 Apr 2026 08:28:37 +0000 (UTC)", "from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n by imap1.dmz-prg2.suse.org with ESMTPSA id pJ4jCDXB8WkpdwAAD6G6ig\n (envelope-from <andrea.cervesato@suse.de>); Wed, 29 Apr 2026 08:28:37 +0000" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1777451317;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=Qt6B9B0EYPllMwPBsYYfd4Tu4JHQoumRSUrDH5aByB8=;\n b=Bu0VURgYb4RIDEPqERYJ5XPsrj9aIorsCV5uULb9Ev2Q492ilRd2JhVMnF0mjFawJEVYQ5\n wi+nNZuad9yyC1g8MKNIpIcY7sLYo2Svfiq4vzktE/dJInXwlPWfYK8NUZWDSlCDc1O6d6\n ZD3hZi59kJWuRo2qLjdfrGjCNYUui7E=", "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1777451317;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=Qt6B9B0EYPllMwPBsYYfd4Tu4JHQoumRSUrDH5aByB8=;\n b=AQn1X7ovjLJTqDqn2EWOWuvAUHsEuXvP7/kvHAMRXHkzSaPVqZ+eV+vXpsfFCclvvBoao6\n 9Cks7DdB2/r7nKCg==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1777451317;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=Qt6B9B0EYPllMwPBsYYfd4Tu4JHQoumRSUrDH5aByB8=;\n b=Bu0VURgYb4RIDEPqERYJ5XPsrj9aIorsCV5uULb9Ev2Q492ilRd2JhVMnF0mjFawJEVYQ5\n wi+nNZuad9yyC1g8MKNIpIcY7sLYo2Svfiq4vzktE/dJInXwlPWfYK8NUZWDSlCDc1O6d6\n ZD3hZi59kJWuRo2qLjdfrGjCNYUui7E=", "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1777451317;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=Qt6B9B0EYPllMwPBsYYfd4Tu4JHQoumRSUrDH5aByB8=;\n b=AQn1X7ovjLJTqDqn2EWOWuvAUHsEuXvP7/kvHAMRXHkzSaPVqZ+eV+vXpsfFCclvvBoao6\n 9Cks7DdB2/r7nKCg==" ], "From": "Andrea Cervesato <andrea.cervesato@suse.de>", "Date": "Wed, 29 Apr 2026 10:28:35 +0200", "MIME-Version": "1.0", "Message-Id": "<20260429-fix_clock_settime_helper-v3-1-2608c39d8499@suse.com>", "X-B4-Tracking": "v=1; b=H4sIADLB8WkC/3XMQQ6CMBSE4auQt7amFtKCK+9hDMF2kEagpK8SE\n 8LdbVy5cfknM99GjOjBdC42ilg9+zDnKA8F2aGbHxDe5SYllZaVakTv360dg322jJT8hHbAuCA\n Ko400soZrqp7yfYnI2y99veXuY5hEGiK6X7D+D65KnITS1qK8G2ekvvCLcbRhon3/AOVZDeS5A\n AAA", "X-Change-ID": "20260429-fix_clock_settime_helper-7670708ed94f", "To": "Linux Test Project <ltp@lists.linux.it>", "X-Mailer": "b4 0.14.2", "X-Developer-Signature": "v=1; a=ed25519-sha256; t=1777451317; l=8467;\n i=andrea.cervesato@suse.com; s=20251210; h=from:subject:message-id;\n bh=ypAJKb2QJBM/OasLlJTAT8siIVcmGCzmSTWJ0Z8Mk3w=;\n b=4D7HbgblEPix3FS16xUEvHhKKeGxfIUGKuX0jXaj83+TZJeeRitO9NYMDNxoVLFBwzgax3krp\n w9GSp3N5MMBDL2WbOqaIknbUdbIo5hEvnTeQPnj2qScnLckRHvHU15m", "X-Developer-Key": "i=andrea.cervesato@suse.com; a=ed25519;\n pk=zKY+6GCauOiuHNZ//d8PQ/UL4jFCTKbXrzXAOQSLevI=", "X-Spamd-Result": "default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n NEURAL_HAM_LONG(-1.00)[-1.000];\n NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain];\n TO_DN_ALL(0.00)[];\n DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[];\n RCPT_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[];\n FROM_HAS_DN(0.00)[]; RCVD_TLS_ALL(0.00)[];\n FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+];\n RCVD_COUNT_TWO(0.00)[2]; RCVD_VIA_SMTP_AUTH(0.00)[];\n DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:mid, suse.com:email,\n imap1.dmz-prg2.suse.org:helo]", "X-Spam-Score": "-4.30", "X-Spam-Level": "", "X-Spam-Status": "No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID,\n DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no\n autolearn=disabled version=4.0.1", "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on in-4.smtp.seeweb.it", "X-Virus-Scanned": "clamav-milter 1.0.9 at in-4.smtp.seeweb.it", "X-Virus-Status": "Clean", "Subject": "[LTP] [PATCH v3] clock_settime: use POSIX runtime detection for\n CLOCK_MONOTONIC", "X-BeenThere": "ltp@lists.linux.it", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "Linux Test Project <ltp.lists.linux.it>", "List-Unsubscribe": "<https://lists.linux.it/options/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=unsubscribe>", "List-Archive": "<http://lists.linux.it/pipermail/ltp/>", "List-Post": "<mailto:ltp@lists.linux.it>", "List-Help": "<mailto:ltp-request@lists.linux.it?subject=help>", "List-Subscribe": "<https://lists.linux.it/listinfo/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it", "Sender": "\"ltp\" <ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>" }, "content": "From: Andrea Cervesato <andrea.cervesato@suse.com>\n\nThe clock_settime helpers.h used a compile-time #ifdef on\n_POSIX_MONOTONIC_CLOCK to select between real and stub\nimplementations of pts_mono_time_start()/pts_mono_time_check().\n\nOn Linux/glibc, _POSIX_MONOTONIC_CLOCK is defined as 0, meaning\nsupport is optional and must be verified at runtime via\nsysconf(_SC_MONOTONIC_CLOCK). The #ifdef treated 0 the same as\n>0 (always available), which is not POSIX-correct.\n\nReplace the compile-time #ifdef/#else split with a runtime\npts_mono_available() helper that performs proper POSIX detection\nvia sysconf(). Extract pts_mono_available() into the shared\ninclude/clock.h so it can be reused by nanosleep helpers as well.\nAlso add a missing #ifndef include guard and #include <unistd.h>\nso _POSIX_MONOTONIC_CLOCK is always defined.\n\nFixes: 9ecb4a004b18 (\"clock_settime: Detect external clock adjustments via CLOCK_MONOTONIC\")\nSigned-off-by: Andrea Cervesato <andrea.cervesato@suse.com>\n---\n .../conformance/interfaces/clock_settime/4-1.c | 1 +\n .../conformance/interfaces/clock_settime/5-1.c | 1 +\n .../conformance/interfaces/clock_settime/5-2.c | 1 +\n .../conformance/interfaces/clock_settime/7-1.c | 1 +\n .../conformance/interfaces/clock_settime/7-2.c | 1 +\n .../conformance/interfaces/clock_settime/helpers.h | 56 +---------------\n testcases/open_posix_testsuite/include/clock.h | 77 ++++++++++++++++++++++\n 7 files changed, 85 insertions(+), 53 deletions(-)\n\n\n---\nbase-commit: 1d2ea5b042a6c6c169689efebd856583200c564f\nchange-id: 20260429-fix_clock_settime_helper-7670708ed94f\n\nBest regards,", "diff": "diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/4-1.c\nindex 631aad7debb242df88bd3493319a82add7e9f0e9..ebd609963a3651212447ff2ab0885e20b19ba302 100644\n--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/4-1.c\n+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/4-1.c\n@@ -28,6 +28,7 @@\n #include <signal.h>\n #include <unistd.h>\n #include \"posixtest.h\"\n+#include \"clock.h\"\n #include \"helpers.h\"\n \n // SLEEPTIME < TIMEROFFSET\ndiff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-1.c\nindex ff8660f18e73df472463ebd7316a436402b1b6ba..06023036cf4c704c43ec64cfaed75157973f3524 100644\n--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-1.c\n+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-1.c\n@@ -23,6 +23,7 @@\n #include <unistd.h>\n #include <stdlib.h>\n #include \"posixtest.h\"\n+#include \"clock.h\"\n #include \"helpers.h\"\n \n #define TIMERSEC 5\ndiff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-2.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-2.c\nindex de1a8e422f86e2cd71e8237fe77d5083f541b599..bb4e86c2fef77e75f9216c7fe59930d71e5715a0 100644\n--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-2.c\n+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-2.c\n@@ -23,6 +23,7 @@\n #include <unistd.h>\n #include <stdlib.h>\n #include \"posixtest.h\"\n+#include \"clock.h\"\n #include \"helpers.h\"\n \n #define TIMERSEC 5\ndiff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/7-1.c\nindex 7009b38b42a730a3526724c14843f1656a16d30a..0ed40fe612506d5a571003d4d9b592a3faab608c 100644\n--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/7-1.c\n+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/7-1.c\n@@ -24,6 +24,7 @@\n #include <unistd.h>\n #include <sys/wait.h>\n #include \"posixtest.h\"\n+#include \"clock.h\"\n #include \"helpers.h\"\n \n #define SLEEPOFFSET 5\ndiff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/7-2.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/7-2.c\nindex 6713369be4c31c4076a493a224a85f24b5120a83..6162152e574e51cfce095b518314132d331ee68f 100644\n--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/7-2.c\n+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/7-2.c\n@@ -23,6 +23,7 @@\n #include <unistd.h>\n #include <sys/wait.h>\n #include \"posixtest.h\"\n+#include \"clock.h\"\n #include \"helpers.h\"\n \n #define SLEEPOFFSET 5\ndiff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/helpers.h b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/helpers.h\nindex 37bf30926f039553e9e370751b7938ca5ea1d00a..c559c189c163d7f7e1fb995b0806933504b278ab 100644\n--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/helpers.h\n+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/helpers.h\n@@ -13,7 +13,8 @@\n * by those tests.\n */\n \n-#include <stdlib.h>\n+#ifndef CLOCK_SETTIME_HELPERS_H\n+#define CLOCK_SETTIME_HELPERS_H\n \n static int getBeforeTime(struct timespec *tpget)\n {\n@@ -35,55 +36,4 @@ static int setBackTime(struct timespec tpset)\n \treturn PTS_PASS;\n }\n \n-#define PTS_MONO_MAX_RETRIES 3\n-\n-#ifdef _POSIX_MONOTONIC_CLOCK\n-static struct timespec _pts_mono_start;\n-\n-static inline int pts_mono_time_start(void)\n-{\n-\tif (clock_gettime(CLOCK_MONOTONIC, &_pts_mono_start) != 0) {\n-\t\tperror(\"clock_gettime(CLOCK_MONOTONIC) failed\");\n-\t\treturn -1;\n-\t}\n-\treturn 0;\n-}\n-\n-static inline int pts_mono_time_check(unsigned int expected_secs)\n-{\n-\tstruct timespec now;\n-\tlong elapsed;\n-\n-\tif (clock_gettime(CLOCK_MONOTONIC, &now) != 0) {\n-\t\tperror(\"clock_gettime(CLOCK_MONOTONIC) failed\");\n-\t\treturn -1;\n-\t}\n-\n-\telapsed = now.tv_sec - _pts_mono_start.tv_sec;\n-\n-\tif (labs(elapsed - (long)expected_secs) > 1) {\n-\t\tprintf(\"Clock adjustment detected (elapsed %lds, expected ~%us)\\n\",\n-\t\t elapsed, expected_secs);\n-\t\treturn 1;\n-\t}\n-\treturn 0;\n-}\n-#else\n-static inline int pts_mono_time_start(void)\n-{\n-\tstatic int warned;\n-\n-\tif (!warned) {\n-\t\tprintf(\"CLOCK_MONOTONIC unavailable, test may fail due to clock adjustment\\n\");\n-\t\twarned = 1;\n-\t}\n-\treturn 0;\n-}\n-\n-static inline int pts_mono_time_check(unsigned int expected_secs)\n-{\n-\t(void)expected_secs;\n-\treturn 0;\n-}\n-#endif\n-\n+#endif /* CLOCK_SETTIME_HELPERS_H */\ndiff --git a/testcases/open_posix_testsuite/include/clock.h b/testcases/open_posix_testsuite/include/clock.h\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..221dd38ff34b627aa5f6c07825cd7439cf559c74\n--- /dev/null\n+++ b/testcases/open_posix_testsuite/include/clock.h\n@@ -0,0 +1,77 @@\n+/*\n+ * Copyright (c) 2026, Linux Test Project\n+ * SPDX-License-Identifier: GPL-2.0-or-later\n+ */\n+\n+#ifndef PTS_CLOCK_H\n+#define PTS_CLOCK_H\n+\n+#include <stdio.h>\n+#include <stdlib.h>\n+#include <time.h>\n+#include <unistd.h>\n+\n+static inline int pts_mono_available(void)\n+{\n+#ifdef _POSIX_MONOTONIC_CLOCK\n+\tif (_POSIX_MONOTONIC_CLOCK > 0)\n+\t\treturn 1;\n+\n+\tif (!_POSIX_MONOTONIC_CLOCK && sysconf(_SC_MONOTONIC_CLOCK) > 0)\n+\t\treturn 1;\n+#endif\n+\treturn 0;\n+}\n+\n+#define PTS_MONO_MAX_RETRIES 3\n+\n+static struct timespec pts_mono_start;\n+\n+static inline int pts_mono_time_start(void)\n+{\n+\tif (!pts_mono_available()) {\n+\t\tstatic int warned;\n+\n+\t\tif (!warned) {\n+\t\t\tprintf(\"CLOCK_MONOTONIC unavailable, test may fail due to clock adjustment\\n\");\n+\t\t\twarned = 1;\n+\t\t}\n+\t\treturn 0;\n+\t}\n+\n+#ifdef _POSIX_MONOTONIC_CLOCK\n+\tif (clock_gettime(CLOCK_MONOTONIC, &pts_mono_start) != 0) {\n+\t\tperror(\"clock_gettime(CLOCK_MONOTONIC) failed\");\n+\t\treturn -1;\n+\t}\n+#endif\n+\treturn 0;\n+}\n+\n+static inline int pts_mono_time_check(unsigned int expected_secs)\n+{\n+#ifdef _POSIX_MONOTONIC_CLOCK\n+\tif (pts_mono_available()) {\n+\t\tstruct timespec now;\n+\t\tlong elapsed;\n+\n+\t\tif (clock_gettime(CLOCK_MONOTONIC, &now) != 0) {\n+\t\t\tperror(\"clock_gettime(CLOCK_MONOTONIC) failed\");\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\telapsed = now.tv_sec - pts_mono_start.tv_sec;\n+\n+\t\tif (labs(elapsed - (long)expected_secs) > 1) {\n+\t\t\tprintf(\"Clock adjustment detected (elapsed %lds, expected ~%us)\\n\",\n+\t\t\t elapsed, expected_secs);\n+\t\t\treturn 1;\n+\t\t}\n+\t\treturn 0;\n+\t}\n+#endif\n+\t(void)expected_secs;\n+\treturn 0;\n+}\n+\n+#endif /* PTS_CLOCK_H */\n", "prefixes": [ "v3" ] }