What do I need to do to make gcc
include the declaration of gmtime_r(3)
from time.h
? Looking at /usr/include/time.h
, gmtime_r
and localtime_r
are inside #ifdef __USE_POSIX
.
Do I need to do something to turn __USE_POSIX
on, like a command-line option? I'm running with -std=c99
now. I understand that __USE_*
macros are not intended to be set directly by user code.
/* Return the `struct tm' representation of *TIMER
in Universal Coordinated Time (aka Greenwich Mean Time). */
extern struct tm *gmtime (const time_t *__timer) __THROW;
/* Return the `struct tm' representation
of *TIMER in the local timezone. */
extern struct tm *localtime (const time_t *__timer) __THROW;
#ifdef __USE_POSIX
/* Return the `struct tm' representation of *TIMER in UTC,
using *TP to store the result. */
extern struct tm *gmtime_r (const time_t *__restrict __timer,
struct tm *__restrict __tp) __THROW;
/* Return the `struct tm' representation of *TIMER in local time,
using *TP to store the result. */
extern struct tm *localtime_r (const time_t *__restrict __timer,
struct tm *__restrict __tp) __THROW;
#endif /* POSIX */