} } while (0)
+#ifdef HOST_WIN32
+# define LOG_LOCALTIME localtime
+#else
+# define LOG_LOCALTIME localtime_r
+#endif
+
#define SGEN_LOG(level, format, ...) do { \
if (G_UNLIKELY ((level) <= SGEN_MAX_DEBUG_LEVEL && (level) <= gc_debug_level)) { \
time_t t; \
struct tm tod; \
char logTime[80]; \
time(&t); \
- localtime_r(&t, &tod); \
+ LOG_LOCALTIME(&t, &tod); \
strftime(logTime, sizeof(logTime), "%F %T", &tod); \
mono_gc_printf (gc_debug_file, "%s " format "\n", logTime, ##__VA_ARGS__); \
} } while (0)
struct tm tod; \
char logTime[80]; \
time(&t); \
- localtime_r(&t,&tod); \
+ LOG_LOCALTIME(&t,&tod); \
strftime(logTime, sizeof(logTime), "%F %T", &tod); \
mono_gc_printf (gc_debug_file, "%s " format "\n", logTime, ##__VA_ARGS__); \
} \