RTEMS Target Issue #4 - timespec2bintime and strptime

Joel Sherrill joel.sherrill@oarcorp.com
Mon Mar 21 00:52:00 GMT 2016


Hi

I have stripped a new warning in RTEMS down to needing to
define both _XOPEN_SOURCE and _BSD_SOURCE to be able
to use strptime() and timespec2bintime() in the same file.
Does the use of feature enable macros look OK in this
test case?

And no.. this code isn't functional at all. It just invokes the
methods in question. :)

==========================
#define _XOPEN_SOURCE
#define _BSD_SOURCE
#include <sys/time.h>
#include <time.h>

static void _Timestamp_Set(
   struct bintime *_time,
   time_t          _seconds,
   long            _nanoseconds
)
{
   struct timespec _ts;

   _ts.tv_sec = _seconds;
   _ts.tv_nsec = _nanoseconds;

   timespec2bintime( &_ts, _time );

   char buffer[80];
   struct tm tm;

   char *c = strptime( buffer, "%%", &tm );
}
==========================

Thanks.

--joel



More information about the Newlib mailing list