Skip to content

Commit

Permalink
Use localtime for Win32 and localtime_r for others
Browse files Browse the repository at this point in the history
Commit migrated from mono/mono@927a3d1
  • Loading branch information
nealef committed Jun 2, 2016
1 parent 6133f01 commit 391f5da
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/mono/mono/sgen/sgen-gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,19 @@ extern guint64 stat_objects_copied_major;
} } 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)
Expand All @@ -146,7 +152,7 @@ extern guint64 stat_objects_copied_major;
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__); \
} \
Expand Down

0 comments on commit 391f5da

Please sign in to comment.