public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* C11 conformance: <uchar.h>, TIME_UTC, timespec_get
@ 2022-03-02 23:16 Pavel M
  2022-05-10 15:35 ` Pavel M
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel M @ 2022-03-02 23:16 UTC (permalink / raw)
  To: newlib

#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...)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: C11 conformance: <uchar.h>, TIME_UTC, timespec_get
  2022-03-02 23:16 C11 conformance: <uchar.h>, TIME_UTC, timespec_get Pavel M
@ 2022-05-10 15:35 ` Pavel M
  2022-05-10 17:17   ` Brian Inglis
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel M @ 2022-05-10 15:35 UTC (permalink / raw)
  To: newlib

Hi all,
Any updates?

On Thu, 3 Mar 2022 at 02:16, Pavel M <pavel.morozkin@gmail.com> wrote:

> #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...)
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: C11 conformance: <uchar.h>, TIME_UTC, timespec_get
  2022-05-10 15:35 ` Pavel M
@ 2022-05-10 17:17   ` Brian Inglis
  2022-05-10 18:06     ` Pavel M
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Inglis @ 2022-05-10 17:17 UTC (permalink / raw)
  To: newlib

On 2022-05-10 09:35, Pavel M wrote:
> Hi all,
> Any updates?

Nobody else has noticed or mentioned those in the last decade, so there 
may not be, as volunteers have limited time and their own interests and 
priorities.

Given that newlib is a freestanding implementation, and gcc does not 
provide that header, those definitions or declarations, these are 
considered platform implementation issues, which someone supporting that 
platform has to decide if they will provide and support.

ICU provides uchar.h which Cygwin libicu-devel maintainer installs under 
/usr/include/unicode/ with Unicode licence under 
/usr/share/icu/<VERSION>/LICENSE.
You could pull those two files from the ICU distro for use in your work.

It also is/will be available on glibc platforms which support it.
Remember that GNU products are GPL licensed with possibly undesirable 
requirements for most commercial products.

Similarly, TIME_UTC may not be available on some newlib 
platforms/targets, so it will be up to platform and/or target 
maintainers to decide if they can support it, and provide implementations.

I don't know what your host platform is, your newlib target, or what 
POSIX time.h CLOCK_/clock_... support is available, but you may wish to 
use that instead, until someone can provide the ISO C equivalent in 
newlib under a BSD licence.

You may also wish to look at what is available in *BSD sources.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: C11 conformance: <uchar.h>, TIME_UTC, timespec_get
  2022-05-10 17:17   ` Brian Inglis
@ 2022-05-10 18:06     ` Pavel M
  0 siblings, 0 replies; 4+ messages in thread
From: Pavel M @ 2022-05-10 18:06 UTC (permalink / raw)
  To: newlib

Thanks.

To remind: from Cygwin FAQ
<https://www.cygwin.com/faq.html#faq.programming.glibc>:
> Where is glibc?
> Cygwin does not provide glibc. It uses newlib instead, which provides
much (but not all)
> of the same functionality. Porting glibc to Cygwin would be difficult.

I didn't know that newlib is a freestanding implementation.

OK, I'll try to mitigate using libicu-devel, etc.

On Tue, 10 May 2022 at 20:17, Brian Inglis <Brian.Inglis@systematicsw.ab.ca>
wrote:

> On 2022-05-10 09:35, Pavel M wrote:
> > Hi all,
> > Any updates?
>
> Nobody else has noticed or mentioned those in the last decade, so there
> may not be, as volunteers have limited time and their own interests and
> priorities.
>
> Given that newlib is a freestanding implementation, and gcc does not
> provide that header, those definitions or declarations, these are
> considered platform implementation issues, which someone supporting that
> platform has to decide if they will provide and support.
>
> ICU provides uchar.h which Cygwin libicu-devel maintainer installs under
> /usr/include/unicode/ with Unicode licence under
> /usr/share/icu/<VERSION>/LICENSE.
> You could pull those two files from the ICU distro for use in your work.
>
> It also is/will be available on glibc platforms which support it.
> Remember that GNU products are GPL licensed with possibly undesirable
> requirements for most commercial products.
>
> Similarly, TIME_UTC may not be available on some newlib
> platforms/targets, so it will be up to platform and/or target
> maintainers to decide if they can support it, and provide implementations.
>
> I don't know what your host platform is, your newlib target, or what
> POSIX time.h CLOCK_/clock_... support is available, but you may wish to
> use that instead, until someone can provide the ISO C equivalent in
> newlib under a BSD licence.
>
> You may also wish to look at what is available in *BSD sources.
>
> --
> Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
>
> This email may be disturbing to some readers as it contains
> too much technical detail. Reader discretion is advised.
> [Data in binary units and prefixes, physical quantities in SI.]
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-10 18:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02 23:16 C11 conformance: <uchar.h>, TIME_UTC, timespec_get Pavel M
2022-05-10 15:35 ` Pavel M
2022-05-10 17:17   ` Brian Inglis
2022-05-10 18:06     ` Pavel M

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).