Add a (non-recursive) implementation of localtime_r for MinGW32.
MinGW does not include the Windows Visual C function localtime_s,
so the implementation uses localtime() instead.
---
 include/babeltrace/compat/time.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/babeltrace/compat/time.h b/include/babeltrace/compat/time.h
index 3238d58..5f23bfa 100644
--- a/include/babeltrace/compat/time.h
+++ b/include/babeltrace/compat/time.h
@@ -16,5 +16,14 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result)
        return result;
 }
 
+static inline
+struct tm *localtime_r(const time_t *timep, struct tm *result)
+{
+       struct tm * r;
+
+       r = localtime(timep);
+       memcpy(result, r, sizeof (struct tm));
+       return result;
+}
 #endif
 #endif
-- 
1.8.1.msysgit.1


_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Reply via email to