On Thu, May 2, 2013 at 7:52 AM, Ikaheimonen, JP <[email protected]> wrote: > Add a (non-recursive) implementation of gmtime_r as it is > missing in the MinGW standard library. > Implementation is written in file include/babeltrace/compat/time.h > which must be included in the source files that call gmtime_r. > --- > formats/ctf/ctf.c | 1 + > include/babeltrace/compat/time.h | 19 +++++++++++++++++++ > 2 files changed, 20 insertions(+) > create mode 100644 include/babeltrace/compat/time.h > > diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c > index 0cfad44..255a492 100644 > --- a/formats/ctf/ctf.c > +++ b/formats/ctf/ctf.c > @@ -52,6 +52,7 @@ > #include "metadata/ctf-ast.h" > #include "events-private.h" > #include "babeltrace/compat/memstream.h" > +#include <babeltrace/compat/time.h> > > #define LOG2_CHAR_BIT 3 > > diff --git a/include/babeltrace/compat/time.h > b/include/babeltrace/compat/time.h > new file mode 100644 > index 0000000..ccfc860 > --- /dev/null > +++ b/include/babeltrace/compat/time.h > @@ -0,0 +1,19 @@ > +#ifndef _BABELTRACE_INCLUDE_COMPAT_TIME_H > +#define _BABELTRACE_INCLUDE_COMPAT_TIME_H > + > +#include <time.h> > +#include <stdlib.h> > + > +#ifdef __MINGW32__ > + > +static inline > +struct tm *gmtime_r(const time_t *timep, struct tm *result) > +{ > + struct tm * r; > + r = gmtime(timep); > + memcpy(result, r, sizeof (struct tm)); > + return result; > +}
Why not use gmtime_s? Inverting the arguments should do the trick. > + > +#endif > +#endif > -- > 1.8.1.msysgit.1 > > > _______________________________________________ > lttng-dev mailing list > [email protected] > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Jérémie Galarneau EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
