| Message ID | 20260416220622.3404924-2-joel@rtems.org |
|---|---|
| State | New |
| Headers |
Return-Path: <newlib-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id BA2814C900F9 for <patchwork@sourceware.org>; Thu, 16 Apr 2026 22:07:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA2814C900F9 X-Original-To: newlib@sourceware.org Delivered-To: newlib@sourceware.org Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) by sourceware.org (Postfix) with ESMTPS id 4E4564BA23F9 for <newlib@sourceware.org>; Thu, 16 Apr 2026 22:07:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4E4564BA23F9 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rtems.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4E4564BA23F9 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.128.170 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776377236; cv=none; b=axuNszBEjJsMJp4k10T2nNSR1d8aKJDtS21jU8+fr0CCmSweiSxZYhhlTucSJO5Rw1/3fknf7rfJ8+41tCQS6VThoqk7dJXa+oDtu9DOZJiEKpTGuwFwaWCu1q5/keVly534ChhUKJfrFl5S+f3M1TN16cKUUDsWlXGvi6xwxwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776377236; c=relaxed/simple; bh=inTQbtgWjzJJ81fw/haJ6OsNDa8CKrT2BBMyEvYOYZo=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=qh474XToMFYT1o4kQosdh2t/6C27/9RECEzWEq0b66fJTbPYREa9Ygs4ErCu57tHMbYiDsGk3Qnxsj/bkfAjy/UM1PYYrvUo35ayCAPv0O0B5unsuGmPZ5DtacB9dLPSz89/iEoLdFkndJjzK4+kbYNYBDFSmQ4ToFqoLiobiLk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E4564BA23F9 Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-79885f4a8ffso104337b3.3 for <newlib@sourceware.org>; Thu, 16 Apr 2026 15:07:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776377235; x=1776982035; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=lLiNHbmnvb4oiWrTNvUpMaQcH8GdmqHFnyakP5KPPSQ=; b=nMXAGHIF995z33UvcsCdNTzqdaUtiJO+M9csMRc/QzWZooe2V9b2qWsuG3IBX6YD5l ym0v148gitXDXE5fZ9+tRl1R121/wbfkf+CCQuyKXVGrAy2hUf6aysXdNaeZwDr0aeF3 4xv+4DonmgvckLumwCwPj3eNP4fgrdcPYJVj/Lt32YZiJ8VLzTkOR+aVF/HPwfxbrr2P YYwW/bTPx8XsxVVk2cbVIRE4614cLL+yYWMcehtWo2Wej38PCvqmnapzdFBmfPw0Y4iJ qSlgkiszpkw0/qvx8DLuaMbOA3/7Bt73/n8PFZJALU0GN4OkgQtT6fbDQ42yq55aHwF+ Icaw== X-Gm-Message-State: AOJu0YzgbyflTXk+RDjIj0XRWybXll+y1VeRao1479WtgTa8SG1LEJDQ 6qmUnw65uPI494t7OdxyF4NkxdpDu3c3InrXJlv9jgIho4u62btgY3ivjQbgpje5 X-Gm-Gg: AeBDieuyxWO7MfJQBvgDOtruTx4rScS1+7vzIiyUHoTRs+keSepjrxLmM+0ezvj9POR cIQd97ieAOdLAqp74qxZASV7oCyaajkud26ZEjh9HhPlBvXiVAz7NW/sNPfP2k883Vc96qHHAak nPCmj3mGe90fJwRnM/26XYljN6E/ARZ086P4jTB7NmXEIVwLc5gToS0gSQMt5ID0EUP55qAkEmC hqbIn+UDClGm9/7vZnXkeh3/6POPHlQVQEKSAiMQh4B3QfUJpYF3nM21LYAgM+3IWOGTFnTydUg 0/WAEhYRtEbGjpCvTtsqYIzsPjhclCrshfuoN3qO5tHx55u0Cm7G7QYiQiIcXdsbkx4GlkZbG4s o2Idz/OyAUqGcr2XWwjgeolpRGm+za4R80+vl/O19apSDI1JVUDdqGNDExk2RcI1pdRkkV/XX6s uLCAK0TzrohdF7WQnQVedp4kC+jQWc/pER/qTfnUJqdkpY2yDq9DtQ+1XPzI4+X1tFFwEscE5F X-Received: by 2002:a05:690c:8d07:b0:7b2:6177:2af1 with SMTP id 00721157ae682-7b9ecf79e37mr3222797b3.31.1776377235008; Thu, 16 Apr 2026 15:07:15 -0700 (PDT) Received: from gitlab.oarcorp.com (d27-96-189-151.evv.wideopenwest.com. [96.27.151.189]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7b766215552sm30549087b3.9.2026.04.16.15.07.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 15:07:14 -0700 (PDT) From: Joel Sherrill <joel@rtems.org> To: newlib@sourceware.org Cc: Joel Sherrill <joel@rtems.org> Subject: [PATCH 2/2] libc/include/time.h: Add TIME_MONOTONIC for C23 Date: Thu, 16 Apr 2026 17:06:22 -0500 Message-ID: <20260416220622.3404924-2-joel@rtems.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260416220622.3404924-1-joel@rtems.org> References: <20260416220622.3404924-1-joel@rtems.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3036.9 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Newlib mailing list <newlib.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/newlib>, <mailto:newlib-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/newlib/> List-Post: <mailto:newlib@sourceware.org> List-Help: <mailto:newlib-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/newlib>, <mailto:newlib-request@sourceware.org?subject=subscribe> Errors-To: newlib-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
[1/2] libc/include/time.h: Add C23 timespec_getres()
|
|
Commit Message
Joel Sherrill
April 16, 2026, 10:06 p.m. UTC
--- newlib/libc/include/time.h | 3 +++ 1 file changed, 3 insertions(+)
Comments
> From: Joel Sherrill <joel@rtems.org> > Sent: Thursday, April 16, 2026 6:06 PM > To: newlib@sourceware.org <newlib@sourceware.org> > Cc: Joel Sherrill <joel@rtems.org> > Subject: [PATCH 2/2] libc/include/time.h: Add TIME_MONOTONIC for C23 > --- > newlib/libc/include/time.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h > index e972bd416..429dd8bd9 100644 > --- a/newlib/libc/include/time.h > +++ b/newlib/libc/include/time.h > @@ -63,6 +63,9 @@ time_t time (time_t *_timer); > int timespec_get(struct timespec *ts, int base); > #endif > #if (__ISO_C_VISIBLE >= 2023) > +#define TIME_MONOTONIC 2 > +#endif > +#if (__ISO_C_VISIBLE >= 2023) > int timespec_getres(struct timespec *ts, int base); > #endif > #ifndef _REENT_ONLY Any particular reason for two of the same #if? I can't think of one, merge them. Additionally, this also could be grouped within the preceding #if (__ISO_C_VISIBLE >= 2011 || __POSIX_VISIBLE >= 202405), which would make it read a little more cleanly. Speaking of cleanly, this diff appears to be based on a corrupted file version, fails to apply. (It is lacking #define TIME_UTC, e.g.) Snippet from present time.h: #if (__ISO_C_VISIBLE >= 2011 || __POSIX_VISIBLE >= 202405) #define TIME_UTC 1 int timespec_get(struct timespec *ts, int base); #endif Suggested end result: #if (__ISO_C_VISIBLE >= 2011 || __POSIX_VISIBLE >= 202405) #define TIME_UTC 1 int timespec_get(struct timespec *ts, int base); #if (__ISO_C_VISIBLE >= 2023) #define TIME_MONOTONIC 2 int timespec_getres(struct timespec *ts, int base); #endif #endif Craig
On Apr 16 23:24, Howland, Craig D. - US via Newlib wrote: > > From: Joel Sherrill <joel@rtems.org> > > Sent: Thursday, April 16, 2026 6:06 PM > > To: newlib@sourceware.org <newlib@sourceware.org> > > Cc: Joel Sherrill <joel@rtems.org> > > Subject: [PATCH 2/2] libc/include/time.h: Add TIME_MONOTONIC for C23 > > --- > > newlib/libc/include/time.h | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h > > index e972bd416..429dd8bd9 100644 > > --- a/newlib/libc/include/time.h > > +++ b/newlib/libc/include/time.h > > @@ -63,6 +63,9 @@ time_t time (time_t *_timer); > > int timespec_get(struct timespec *ts, int base); > > #endif > > #if (__ISO_C_VISIBLE >= 2023) > > +#define TIME_MONOTONIC 2 > > +#endif > > +#if (__ISO_C_VISIBLE >= 2023) > > int timespec_getres(struct timespec *ts, int base); > > #endif > > #ifndef _REENT_ONLY > > Any particular reason for two of the same #if? I can't think of one, merge them. > Additionally, this also could be grouped within the preceding #if (__ISO_C_VISIBLE >= 2011 || __POSIX_VISIBLE >= 202405), which would make it read a little more cleanly. > Speaking of cleanly, this diff appears to be based on a corrupted file version, fails to apply. (It is lacking #define TIME_UTC, e.g.) > > Snippet from present time.h: > > #if (__ISO_C_VISIBLE >= 2011 || __POSIX_VISIBLE >= 202405) > #define TIME_UTC 1 > > int timespec_get(struct timespec *ts, int base); > #endif > > Suggested end result: > #if (__ISO_C_VISIBLE >= 2011 || __POSIX_VISIBLE >= 202405) > #define TIME_UTC 1 > int timespec_get(struct timespec *ts, int base); > #if (__ISO_C_VISIBLE >= 2023) > #define TIME_MONOTONIC 2 > int timespec_getres(struct timespec *ts, int base); > #endif > #endif Actually, the definitions TIME_UTC and TIME_MONOTONIC should be adjacent to each other. And if TIME_MONOTONIC gets defined, TIME_ACTIVE and TIME_THREAD_ACTIVE should be defined as well, me thinks: #if (__ISO_C_VISIBLE >= 2011 || __POSIX_VISIBLE >= 202405) #define TIME_UTC 1 #endif #if (__ISO_C_VISIBLE >= 2023) #define TIME_MONOTONIC 2 #define TIME_ACTIVE 3 #define TIME_THREAD_ACTIVE 4 #endif and only after that the related functions should be defined. It might be a good idea, to separate out the above macros as well as the functions timespec_get and timespec_getres into it's own block in time.h, too. Corinna
diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h index e972bd416..429dd8bd9 100644 --- a/newlib/libc/include/time.h +++ b/newlib/libc/include/time.h @@ -63,6 +63,9 @@ time_t time (time_t *_timer); int timespec_get(struct timespec *ts, int base); #endif #if (__ISO_C_VISIBLE >= 2023) +#define TIME_MONOTONIC 2 +#endif +#if (__ISO_C_VISIBLE >= 2023) int timespec_getres(struct timespec *ts, int base); #endif #ifndef _REENT_ONLY