From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x935.google.com (mail-ua1-x935.google.com [IPv6:2607:f8b0:4864:20::935]) by sourceware.org (Postfix) with ESMTPS id 484A13858D20 for ; Sat, 25 Mar 2023 20:59:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 484A13858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ua1-x935.google.com with SMTP id 89so3811173uao.0 for ; Sat, 25 Mar 2023 13:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679777995; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=aaUFGLpXrVvLrVJuggVhwKwUleGC2er7yqTTvr4gr7g=; b=EuBHJgzdV8Y51veQv9kU3uyCamk+k9op3mTD4MgH+Tw4q6KNZobl38OJdmgUFFgdUq zF9Nj4Ya6hUDshvz7v5ZWj6p+cmhwF8qpc9CY6NwR58qEQzDwB7UGNZmzKjtLb30JXxs wS/GH1LJeWmo97Frcpo8DkfnWnuR+ewE5bcl2VaI80eYmaXFoj9SQymL8vGyjY5EYYT7 WB1q/VVirRhFkgETdW7C67MsRGvmH6zS2y2xPG52NWPkh00D5Wi9U6rO6IjD/O5xbro7 70eYTaQ76EQHxrogXhy4Bp8QrA62otSoJ1qXev8ncood7+ejyiGaMfGK6S+/BEICY19a vS5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679777995; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=aaUFGLpXrVvLrVJuggVhwKwUleGC2er7yqTTvr4gr7g=; b=u6YrThYsCutjRRcSsiyyoDb8MKuMZVQhLE7aVY3sWn8IIAXvcxgUEpRNG15Lx7MjBk Uf561fDTvvC65GjM1UDDmWRR2MrMsKVGZtZix0wFHjaeh/+/QoAlK8Yc4ydNvgpdLt7s oQaD7rKjUmztudhFCvs2EHj1de9jav/z/pdm9FuplR4CfN5aHZ4hOYcQEhlbygXJWfbu BzNLXNgRS4trhl6trqD+v9yyK0jdhPOaZFfax/9bAjqY/4FK7CG4q9GXZnj9GaXIFH95 BuU6D0UKXvU6QyQw4Jc2Wm+T5CNUImt3R87grU76K+PrtOgggDZQNo2+gYEafBAzohPS Qk7Q== X-Gm-Message-State: AAQBX9e4INRib8h/MyoardUC0Yx1b2a+L6e7IXRC4dLVSGUo2nNf4KlQ pMlCBMnlnGyAtH0/Cav6nW2gEpyaDWuU4UD8UIk/qrq9y3M= X-Google-Smtp-Source: AKy350aTs5IlKmPvvT8VhD/uiXDRC1DvxNx5NtwOWmmrTrk6TXq7Y+htr1NvG5Wi4JKLxfc/FdABr7a2zYrCti3nlsY= X-Received: by 2002:a1f:a809:0:b0:436:5000:ed97 with SMTP id r9-20020a1fa809000000b004365000ed97mr3899212vke.2.1679777995489; Sat, 25 Mar 2023 13:59:55 -0700 (PDT) MIME-Version: 1.0 From: Falco Girgis Date: Sat, 25 Mar 2023 16:59:44 -0400 Message-ID: Subject: C11 timespec_get(), TIME_UTC To: newlib@sourceware.org Content-Type: multipart/alternative; boundary="000000000000b9052805f7bfca62" X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,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 server2.sourceware.org List-Id: --000000000000b9052805f7bfca62 Content-Type: text/plain; charset="UTF-8" Hey guys, I'm a big user and fan of Newlib and have really enjoyed working with it. In addition to it being used in a bunch of the builds I target in CI, I'm one of the maintainers of the KallistiOS indie/homebrew SDK for the Sega Dreamcast, which has an epic amount of modern language and stdlib support for C and C++ thanks to you guys. Anyway, I just encountered something today that is missing that I can't help but feel like should really be included within the lib: support for the C11 timespec struct, timespec_get() function, and the TIME_UTC macro, used to simply get the current UTC time in seconds + nanoseconds: https://en.cppreference.com/w/c/chrono/TIME_UTC Given the amount of non-standard POSIX time functionality that is supported, the modern C++ chrono stuff, the rest of the C stdlib, etc, it feels like this should fall within the scope of the project. It looks like everybody else is just doing a tiny little wrapper for it around clock_gettime(), so it's simple to implement as well... I also see several threads on stack overflow with people confused as to why it's not available to them, so I'm not the only one interested. I've never submitted a patch for anything like this before and wanted to run this by you guys to make sure it fall within NewLib's scope before I was going to give it a shot. What do you guys think? Anyway, thanks again, sorry for the verbosity. --000000000000b9052805f7bfca62--