get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2218118/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2218118,
    "url": "http://patchwork.ozlabs.org/api/patches/2218118/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/ltp/patch/20260331-nanosleep_posix_fix-v2-1-a0b72e6d586d@suse.com/",
    "project": {
        "id": 59,
        "url": "http://patchwork.ozlabs.org/api/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": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260331-nanosleep_posix_fix-v2-1-a0b72e6d586d@suse.com>",
    "list_archive_url": null,
    "date": "2026-03-31T12:42:58",
    "name": "[v2] nanosleep: Use CLOCK_MONOTONIC for elapsed time measurement",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "5982c8df2bd1e4c9a14eb1d53245d5eb1f063a25",
    "submitter": {
        "id": 83220,
        "url": "http://patchwork.ozlabs.org/api/people/83220/?format=api",
        "name": "Andrea Cervesato",
        "email": "andrea.cervesato@suse.de"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/ltp/patch/20260331-nanosleep_posix_fix-v2-1-a0b72e6d586d@suse.com/mbox/",
    "series": [
        {
            "id": 498190,
            "url": "http://patchwork.ozlabs.org/api/series/498190/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/ltp/list/?series=498190",
            "date": "2026-03-31T12:42:58",
            "name": "[v2] nanosleep: Use CLOCK_MONOTONIC for elapsed time measurement",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/498190/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2218118/comments/",
    "check": "success",
    "checks": "http://patchwork.ozlabs.org/api/patches/2218118/checks/",
    "tags": {},
    "related": [],
    "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=CkDu4bFx;\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=5WwJo+sb;\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=kUEYARGJ;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=6UB3uRbz;\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 4flSTC2L8Zz1yCp\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 23:43:11 +1100 (AEDT)",
            "from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id 0AFB63E4EDA\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 14:43:08 +0200 (CEST)",
            "from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6])\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 D42E03C9314\n for <ltp@lists.linux.it>; Tue, 31 Mar 2026 14:43:04 +0200 (CEST)",
            "from smtp-out2.suse.de (smtp-out2.suse.de\n [IPv6:2a07:de40:b251:101:10:150:64:2])\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-6.smtp.seeweb.it (Postfix) with ESMTPS id B8A591400770\n for <ltp@lists.linux.it>; Tue, 31 Mar 2026 14:43:03 +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 00B585BCC3;\n Tue, 31 Mar 2026 12:42:59 +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 C41594A0A2;\n Tue, 31 Mar 2026 12:42:58 +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 jMbMLVLBy2mhKAAAD6G6ig\n (envelope-from <andrea.cervesato@suse.de>); Tue, 31 Mar 2026 12:42:58 +0000"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1774960981;\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=2dZUmZMnw3F0IoY83OcmXK0joa1UAllf+kijxIg4BGw=;\n b=CkDu4bFx50SkZfpoN5v5uyTPgrLySeqjnAXxFIpWkYdrm9ELjDKGXiZH98cPtEfN0/CDob\n geX1AZvCQ71gm2Gab949MAfLF4gY/rPFRNx83J11wxFiSjx/GTIg73sAkxyD53Hx1o/vt9\n oTRYit5ZOgaSUAH3jY9yR+u+sdGitpc=",
            "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1774960981;\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=2dZUmZMnw3F0IoY83OcmXK0joa1UAllf+kijxIg4BGw=;\n b=5WwJo+sbUvXOSAD763XANw1rs0/U+GzdAp4B4LYfOiTotwIjZfSwwViTwplVWycpykpVC0\n XFGcAUxArhpmNCDA==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1774960979;\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=2dZUmZMnw3F0IoY83OcmXK0joa1UAllf+kijxIg4BGw=;\n b=kUEYARGJ+1PQQQDlTjQKiHyxNDish1ZmYKyLPg+qkcq3PndQmL6e3jGV7UimQhAhjBQKL2\n XAUdCX/cm3wwWhul9RD3kEKBjjsw3r1NZ1VlIZ688cCPb+kIqtaM9ooi9M3L94aN4X0lN2\n kTgoboHMqtsA9/MabR6fK1OQ4QsxL3g=",
            "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1774960979;\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=2dZUmZMnw3F0IoY83OcmXK0joa1UAllf+kijxIg4BGw=;\n b=6UB3uRbzYWysU0KL4fwvIbO3GxU7h+2dtQEch+V98YwwCh7r/qiLimzzpVVxfFGgKqkMFG\n DJfH3ENx4KI4d2Cw=="
        ],
        "From": "Andrea Cervesato <andrea.cervesato@suse.de>",
        "Date": "Tue, 31 Mar 2026 14:42:58 +0200",
        "MIME-Version": "1.0",
        "Message-Id": "<20260331-nanosleep_posix_fix-v2-1-a0b72e6d586d@suse.com>",
        "X-B4-Tracking": "v=1; b=H4sIAFHBy2kC/32NQQqDMBBFryKzbooTaSJd9R4iEuJYB9pEMq1YJ\n Hdv6gG6fA/++zsIJSaBa7VDopWFYyigTxX42YU7KR4Lg661qZsGVXAhyoNoGZYovA0Tb8oYNNp\n 575BGKMslUdFHtesLzyyvmD7HyYo/+7+3okJlna3t1Fq8tPomb6Gzj0/oc85fKaa3DLUAAAA=",
        "X-Change-ID": "20260331-nanosleep_posix_fix-66162acca1ed",
        "To": "Linux Test Project <ltp@lists.linux.it>",
        "X-Mailer": "b4 0.14.2",
        "X-Developer-Signature": "v=1; a=ed25519-sha256; t=1774960978; l=11289;\n i=andrea.cervesato@suse.com; s=20251210; h=from:subject:message-id;\n bh=sDDzPrfLLFkMuIea4Z8QGR5Mnru/MTnxI72dqKgm308=;\n b=1uCc9LRFcAUzUgNa8WRZvgxvVs+Hg/DErJ91HYCjN6EHx+t4y0DXyrB504CkBnUAkmY0u6HZL\n LrwB4UtOtakAjhK1CNGd8Oc8sVXbYjOapN2QPRD6//zYRSZraEyV0gb",
        "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 RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[];\n MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com];\n RCVD_TLS_ALL(0.00)[];\n DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n TO_DN_ALL(0.00)[]; FROM_HAS_DN(0.00)[];\n RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[];\n TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2];\n DBL_BLOCKED_OPENRESOLVER(0.00)[anthropic.com:email, suse.com:mid,\n suse.com:email, 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-6.smtp.seeweb.it",
        "X-Virus-Scanned": "clamav-milter 1.0.9 at in-6.smtp.seeweb.it",
        "X-Virus-Status": "Clean",
        "Subject": "[LTP] [PATCH v2] nanosleep: Use CLOCK_MONOTONIC for elapsed time\n measurement",
        "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>",
        "Cc": "Claude <noreply@anthropic.com>",
        "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\nAll nanosleep POSIX conformance tests used CLOCK_REALTIME to measure\nelapsed sleep duration. CLOCK_REALTIME can jump due to NTP corrections,\nVM time sync, or other wall-clock adjustments, causing sporadic test\nfailures where measured time far exceeds expected sleep duration.\n\nSwitch to CLOCK_MONOTONIC which is immune to wall-clock changes and is\nthe correct clock for measuring elapsed durations. Guard with\n_POSIX_MONOTONIC_CLOCK and fall back to CLOCK_REALTIME with a warning\non systems where CLOCK_MONOTONIC is unavailable.\n\nCo-authored-by: Claude <noreply@anthropic.com>\nSigned-off-by: Andrea Cervesato <andrea.cervesato@suse.com>\n---\nChanges in v2:\n- introduce TEST_CLOCK to select the right available clock type\n- print a message in case CLOCK_MONOTONIC is not available\n- Link to v1: https://lore.kernel.org/r/20260331-nanosleep_posix_fix-v1-1-7a707f871582@suse.com\n---\n .../conformance/interfaces/nanosleep/1-1.c                 | 14 ++++++++++++--\n .../conformance/interfaces/nanosleep/1-2.c                 | 14 ++++++++++++--\n .../conformance/interfaces/nanosleep/1-3.c                 | 14 ++++++++++++--\n .../conformance/interfaces/nanosleep/10000-1.c             | 14 ++++++++++++--\n .../conformance/interfaces/nanosleep/2-1.c                 | 14 ++++++++++++--\n .../conformance/interfaces/nanosleep/3-2.c                 | 14 ++++++++++++--\n .../conformance/interfaces/nanosleep/7-2.c                 | 14 ++++++++++++--\n 7 files changed, 84 insertions(+), 14 deletions(-)\n\n\n---\nbase-commit: 4688c20c01eece869b59e05ca3dd68c43e0d6af7\nchange-id: 20260331-nanosleep_posix_fix-66162acca1ed\n\nBest regards,",
    "diff": "diff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-1.c\nindex 687d01e288d914fbbdc18287746f71296c7a4327..75b34346f13d9b62e2333dbc78023a812fc9c908 100644\n--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-1.c\n+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-1.c\n@@ -12,13 +12,23 @@\n #include <time.h>\n #include \"posixtest.h\"\n \n+#ifdef _POSIX_MONOTONIC_CLOCK\n+#define TEST_CLOCK CLOCK_MONOTONIC\n+#else\n+#define TEST_CLOCK CLOCK_REALTIME\n+#endif\n+\n int main(void)\n {\n \tstruct timespec tssleepfor, tsstorage, tsbefore, tsafter;\n \tint sleepnsec = 3;\n \tint slepts = 0, sleptns = 0;\n \n-\tif (clock_gettime(CLOCK_REALTIME, &tsbefore) == -1) {\n+#ifndef _POSIX_MONOTONIC_CLOCK\n+\tprintf(\"CLOCK_MONOTONIC unavailable, test may fail due to external clock adjustments\\n\");\n+#endif\n+\n+\tif (clock_gettime(TEST_CLOCK, &tsbefore) == -1) {\n \t\tperror(\"Error in clock_gettime()\\n\");\n \t\treturn PTS_UNRESOLVED;\n \t}\n@@ -30,7 +40,7 @@ int main(void)\n \t\treturn PTS_UNRESOLVED;\n \t}\n \n-\tif (clock_gettime(CLOCK_REALTIME, &tsafter) == -1) {\n+\tif (clock_gettime(TEST_CLOCK, &tsafter) == -1) {\n \t\tperror(\"Error in clock_gettime()\\n\");\n \t\treturn PTS_UNRESOLVED;\n \t}\ndiff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-2.c\nindex 76f31982508dc87a4f400022cd46fe766071f27d..4a38bd507bba47792b942feb53954b95e92dc222 100644\n--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-2.c\n+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-2.c\n@@ -15,13 +15,23 @@\n #include <sys/wait.h>\n #include \"posixtest.h\"\n \n+#ifdef _POSIX_MONOTONIC_CLOCK\n+#define TEST_CLOCK CLOCK_MONOTONIC\n+#else\n+#define TEST_CLOCK CLOCK_REALTIME\n+#endif\n+\n int main(void)\n {\n \tstruct timespec tssleepfor, tsstorage, tsbefore, tsafter;\n \tint sleepsec = 30;\n \tint pid;\n \n-\tif (clock_gettime(CLOCK_REALTIME, &tsbefore) == -1) {\n+#ifndef _POSIX_MONOTONIC_CLOCK\n+\tprintf(\"CLOCK_MONOTONIC unavailable, test may fail due to external clock adjustments\\n\");\n+#endif\n+\n+\tif (clock_gettime(TEST_CLOCK, &tsbefore) == -1) {\n \t\tperror(\"Error in clock_gettime()\\n\");\n \t\treturn PTS_UNRESOLVED;\n \t}\n@@ -46,7 +56,7 @@ int main(void)\n \t\t\tperror(\"Error waiting for child to exit\\n\");\n \t\t\treturn PTS_UNRESOLVED;\n \t\t}\n-\t\tif (clock_gettime(CLOCK_REALTIME, &tsafter) == -1) {\n+\t\tif (clock_gettime(TEST_CLOCK, &tsafter) == -1) {\n \t\t\tperror(\"Error in clock_gettime()\\n\");\n \t\t\treturn PTS_UNRESOLVED;\n \t\t}\ndiff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-3.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-3.c\nindex 31ac00858018c3741758d0b5f2bf28f87aa6c1bf..7d5600788d6bc4682f228ccc7c669576827c397a 100644\n--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-3.c\n+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-3.c\n@@ -16,6 +16,12 @@\n #include <sys/wait.h>\n #include \"posixtest.h\"\n \n+#ifdef _POSIX_MONOTONIC_CLOCK\n+#define TEST_CLOCK CLOCK_MONOTONIC\n+#else\n+#define TEST_CLOCK CLOCK_REALTIME\n+#endif\n+\n static void handler(int signo PTS_ATTRIBUTE_UNUSED)\n {\n \tprintf(\"In handler\\n\");\n@@ -28,7 +34,11 @@ int main(void)\n \tint pid;\n \tstruct sigaction act;\n \n-\tif (clock_gettime(CLOCK_REALTIME, &tsbefore) == -1) {\n+#ifndef _POSIX_MONOTONIC_CLOCK\n+\tprintf(\"CLOCK_MONOTONIC unavailable, test may fail due to external clock adjustments\\n\");\n+#endif\n+\n+\tif (clock_gettime(TEST_CLOCK, &tsbefore) == -1) {\n \t\tperror(\"Error in clock_gettime()\\n\");\n \t\treturn PTS_UNRESOLVED;\n \t}\n@@ -64,7 +74,7 @@ int main(void)\n \t\t\tperror(\"Error waiting for child to exit\\n\");\n \t\t\treturn PTS_UNRESOLVED;\n \t\t}\n-\t\tif (clock_gettime(CLOCK_REALTIME, &tsafter) == -1) {\n+\t\tif (clock_gettime(TEST_CLOCK, &tsafter) == -1) {\n \t\t\tperror(\"Error in clock_gettime()\\n\");\n \t\t\treturn PTS_UNRESOLVED;\n \t\t}\ndiff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/10000-1.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/10000-1.c\nindex 883885df434fb4ba3bb555dd565880f14623a984..ebcf366acb52fd149f19951a6e4e0764bd503807 100644\n--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/10000-1.c\n+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/10000-1.c\n@@ -19,6 +19,12 @@\n #include <errno.h>\n #include \"posixtest.h\"\n \n+#ifdef _POSIX_MONOTONIC_CLOCK\n+#define TEST_CLOCK CLOCK_MONOTONIC\n+#else\n+#define TEST_CLOCK CLOCK_REALTIME\n+#endif\n+\n #define NUMVALID 6\n #define NUMINVALID 7\n \n@@ -51,18 +57,22 @@ int main(void)\n \tint failure = 0;\n \tint slepts = 0, sleptns = 0;\n \n+#ifndef _POSIX_MONOTONIC_CLOCK\n+\tprintf(\"CLOCK_MONOTONIC unavailable, test may fail due to external clock adjustments\\n\");\n+#endif\n+\n \tfor (i = 0; i < NUMVALID; i++) {\n \t\ttssleepfor.tv_sec = sleepvalid[i][0];\n \t\ttssleepfor.tv_nsec = sleepvalid[i][1];\n \t\tprintf(\"sleep %d sec %d nsec\\n\",\n \t\t       (int)tssleepfor.tv_sec, (int)tssleepfor.tv_nsec);\n-\t\tif (clock_gettime(CLOCK_REALTIME, &tsbefore) == -1) {\n+\t\tif (clock_gettime(TEST_CLOCK, &tsbefore) == -1) {\n \t\t\tperror(\"Error in clock_gettime()\\n\");\n \t\t\treturn PTS_UNRESOLVED;\n \t\t}\n \n \t\tif (nanosleep(&tssleepfor, &tsstorage) == 0) {\n-\t\t\tif (clock_gettime(CLOCK_REALTIME, &tsafter) == -1) {\n+\t\t\tif (clock_gettime(TEST_CLOCK, &tsafter) == -1) {\n \t\t\t\tperror(\"Error in clock_gettime()\\n\");\n \t\t\t\treturn PTS_UNRESOLVED;\n \t\t\t}\ndiff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/2-1.c\nindex cce3941e7be7212ea286647ec601d3ecbb9bb85a..8586e0ecec023029b60bce8ad5e1e72206daee34 100644\n--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/2-1.c\n+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/2-1.c\n@@ -13,6 +13,12 @@\n #include <time.h>\n #include \"posixtest.h\"\n \n+#ifdef _POSIX_MONOTONIC_CLOCK\n+#define TEST_CLOCK CLOCK_MONOTONIC\n+#else\n+#define TEST_CLOCK CLOCK_REALTIME\n+#endif\n+\n #define NUMINTERVALS 13\n int main(void)\n {\n@@ -25,7 +31,11 @@ int main(void)\n \tint failure = 0;\n \tint slepts, sleptns;\n \n-\tif (clock_gettime(CLOCK_REALTIME, &tsbefore) == -1) {\n+#ifndef _POSIX_MONOTONIC_CLOCK\n+\tprintf(\"CLOCK_MONOTONIC unavailable, test may fail due to external clock adjustments\\n\");\n+#endif\n+\n+\tif (clock_gettime(TEST_CLOCK, &tsbefore) == -1) {\n \t\tperror(\"Error in clock_gettime()\\n\");\n \t\treturn PTS_UNRESOLVED;\n \t}\n@@ -38,7 +48,7 @@ int main(void)\n \t\t\treturn PTS_UNRESOLVED;\n \t\t}\n \n-\t\tif (clock_gettime(CLOCK_REALTIME, &tsafter) == -1) {\n+\t\tif (clock_gettime(TEST_CLOCK, &tsafter) == -1) {\n \t\t\tperror(\"Error in clock_gettime()\\n\");\n \t\t\treturn PTS_UNRESOLVED;\n \t\t}\ndiff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/3-2.c\nindex bfc271edf25f9cd0f343eef11b335d5da20eb646..1329a7e988055ed3815e4e4037f331f576264d1a 100644\n--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/3-2.c\n+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/3-2.c\n@@ -16,6 +16,12 @@\n #include <stdlib.h>\n #include \"posixtest.h\"\n \n+#ifdef _POSIX_MONOTONIC_CLOCK\n+#define TEST_CLOCK CLOCK_MONOTONIC\n+#else\n+#define TEST_CLOCK CLOCK_REALTIME\n+#endif\n+\n #define SLEEPSEC 5\n \n #define CHILDPASS 0\t\t//if interrupted, child will return 0\n@@ -26,7 +32,11 @@ int main(void)\n \tint pid, slepts;\n \tstruct timespec tsbefore, tsafter;\n \n-\tif (clock_gettime(CLOCK_REALTIME, &tsbefore) != 0) {\n+#ifndef _POSIX_MONOTONIC_CLOCK\n+\tprintf(\"CLOCK_MONOTONIC unavailable, test may fail due to external clock adjustments\\n\");\n+#endif\n+\n+\tif (clock_gettime(TEST_CLOCK, &tsbefore) != 0) {\n \t\tperror(\"clock_gettime() did not return success\\n\");\n \t\treturn PTS_UNRESOLVED;\n \t}\n@@ -74,7 +84,7 @@ int main(void)\n \t\t\treturn PTS_FAIL;\n \t\t}\n \n-\t\tif (clock_gettime(CLOCK_REALTIME, &tsafter) == -1) {\n+\t\tif (clock_gettime(TEST_CLOCK, &tsafter) == -1) {\n \t\t\tperror(\"Error in clock_gettime()\\n\");\n \t\t\treturn PTS_UNRESOLVED;\n \t\t}\ndiff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-2.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-2.c\nindex caf4470e4a26b27ec79deed27c147e2feceffdf8..70eeca9ff8eb10ac052b81f102853747a5066685 100644\n--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-2.c\n+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-2.c\n@@ -17,6 +17,12 @@\n #include <stdlib.h>\n #include \"posixtest.h\"\n \n+#ifdef _POSIX_MONOTONIC_CLOCK\n+#define TEST_CLOCK CLOCK_MONOTONIC\n+#else\n+#define TEST_CLOCK CLOCK_REALTIME\n+#endif\n+\n #define CHILDSUCCESS 1\n #define CHILDFAILURE 0\n \n@@ -34,7 +40,11 @@ int main(void)\n \tint pid;\n \tstruct sigaction act;\n \n-\tif (clock_gettime(CLOCK_REALTIME, &tsbefore) == -1) {\n+#ifndef _POSIX_MONOTONIC_CLOCK\n+\tprintf(\"CLOCK_MONOTONIC unavailable, test may fail due to external clock adjustments\\n\");\n+#endif\n+\n+\tif (clock_gettime(TEST_CLOCK, &tsbefore) == -1) {\n \t\tperror(\"Error in clock_gettime()\\n\");\n \t\treturn PTS_UNRESOLVED;\n \t}\n@@ -60,7 +70,7 @@ int main(void)\n \t\t\treturn CHILDFAILURE;\n \t\t}\n \n-\t\tif (clock_gettime(CLOCK_REALTIME, &tsafter) == -1) {\n+\t\tif (clock_gettime(TEST_CLOCK, &tsafter) == -1) {\n \t\t\tperror(\"Error in clock_gettime()\\n\");\n \t\t\treturn CHILDFAILURE;\n \t\t}\n",
    "prefixes": [
        "v2"
    ]
}