On Feb 15 14:54, Patrick Chkoreff wrote: > Corinna Vinschen wrote on 2/15/21 4:14 AM: > > > That looks wrong. The __USE_<standard> flags are internal flags from > > GLibc and not supposed to be used by application code. Check the Linux > > man page for strptime, the usage of _XOPEN_SOURCE or another flag > > including _XOPEN_SOURCE (e. g. _GNU_SOURCE) is required. So this: > > > > #define _XOPEN_SOURCE > > #include <time.h> > > One would think so, but I tried it on two different Linux machines and > it failed with: > > error: ‘strptime’ undeclared > > To fix that, I must define _USE_XOPEN
You really, really must not use this macro. > #else > > #include <stdint.h> > #include <sys/time.h> > #define __USE_XOPEN > #include <time.h> > > #endif > > void stuff(void) > { > uint64_t n; > time_t t; > struct timeval tv; > (void)n; > (void)t; > (void)tv; > (void)time; > (void)gettimeofday; > (void)timegm; > (void)timelocal; > (void)gmtime; > (void)localtime; > (void)strftime; > (void)strptime; > } The problem here is that you mix functions only defined under _XOPEN_SOURCE with stuff only defined with _DEFAULT_SOURCE from the same header. Either define both feature test macros, or define _GNU_SOURCE. This works: #define _XOPEN_SOURCE #define _DEFAULT_SOURCE #include <stdint.h> #include <sys/time.h> #include <time.h> void stuff(void) [...] This works, too: #define _GNU_SOURCE #include <stdint.h> #include <sys/time.h> #include <time.h> void stuff(void) [...] Corinna -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple