summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2012-02-20 18:10:09 +0100
committerChristophe Fergeau <cfergeau@redhat.com>2012-03-01 12:59:05 +0100
commit84628d54755b66076da402015341100f7b9a0027 (patch)
tree19476080a52b3a14ae82f909afc6e6343108bcee /common
parent025d0bd58019051ef269c8b80147ba38964308d8 (diff)
mingw: workaround _ftime_s bug
mingw has a _ftime_s prototype in its headers, but no corresponding symbol available at link time. Workaround this issue for now by #defining it to _ftime. This is untested on win64 where the workaround may not be needed.
Diffstat (limited to 'common')
-rw-r--r--common/vdlog.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/common/vdlog.h b/common/vdlog.h
index eebb0d2..b2a7295 100644
--- a/common/vdlog.h
+++ b/common/vdlog.h
@@ -57,13 +57,19 @@ static unsigned int log_level = LOG_INFO;
printf("%lu::%s::%s,%.3d::%s::" format "\n", GetCurrentThreadId(), type, datetime, ms, \
__FUNCTION__, ## __VA_ARGS__);
+#ifdef __MINGW32__
+#define vd_ftime_s _ftime
+#else
+#define vd_ftime_s _ftime_s
+#endif
+
#define LOG(type, format, ...) if (type >= log_level && type <= LOG_FATAL) { \
VDLog* log = VDLog::get(); \
const char *type_as_char[] = { "DEBUG", "INFO", "WARN", "ERROR", "FATAL" }; \
struct _timeb now; \
struct tm today; \
char datetime_str[20]; \
- _ftime_s(&now); \
+ vd_ftime_s(&now); \
localtime_s(&today, &now.time); \
strftime(datetime_str, 20, "%Y-%m-%d %H:%M:%S", &today); \
if (log) { \