public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Pavel M <pavel.morozkin@gmail.com>
To: newlib@sourceware.org
Subject: C11 conformance: <uchar.h>, TIME_UTC, timespec_get
Date: Thu, 3 Mar 2022 02:16:13 +0300	[thread overview]
Message-ID: <CAL9Mx1sqGY2YrB-24u3jHtB=psDAR0NAvz5iw+ghhW2V7KD+gQ@mail.gmail.com> (raw)

#include <stdio.h>#include <time.h>
int main(void)
{
    struct timespec ts;
    timespec_get(&ts, TIME_UTC);
    char buff[100];
    strftime(buff, sizeof buff, "%D %T", gmtime(&ts.tv_sec));
    printf("Current time: %s.%09ld UTC\n", buff, ts.tv_nsec);
    return 0;
}

$ gcc t667c.c -std=c11 -pedantic -Wall -Wextra
t667c.c: In function ‘main’:
t667c.c:7:5: warning: implicit declaration of function ‘timespec_get’
[-Wimplicit-function-declaration]
    7 |     timespec_get(&ts, TIME_UTC);
      |     ^~~~~~~~~~~~
t667c.c:7:23: error: ‘TIME_UTC’ undeclared (first use in this function)
    7 |     timespec_get(&ts, TIME_UTC);
      |                       ^~~~~~~~
t667c.c:7:23: note: each undeclared identifier is reported only once
for each function it appears in

$ echo "#include <uchar.h>" | gcc -xc - -std=c11 -pedantic -Wall -Wextra
<stdin>:1:10: fatal error: uchar.h: No such file or directory
compilation terminated.

$ gcc --versiongcc (GCC) 11.2.0

$ uname -a
CYGWIN_NT-10.0 xxx 3.3.4(0.341/5/3) 2022-01-31 19:35 x86_64 Cygwin

_NEWLIB_VERSION: 4.1.0
__STDC__: 1 (hm...)

             reply	other threads:[~2022-03-02 23:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02 23:16 Pavel M [this message]
2022-05-10 15:35 ` Pavel M
2022-05-10 17:17   ` Brian Inglis
2022-05-10 18:06     ` Pavel M

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='CAL9Mx1sqGY2YrB-24u3jHtB=psDAR0NAvz5iw+ghhW2V7KD+gQ@mail.gmail.com' \
    --to=pavel.morozkin@gmail.com \
    --cc=newlib@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).