diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2012-02-20 18:10:09 +0100 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2012-02-23 22:34:46 +0100 |
commit | a6955ff9f4e4d2d4634f822e923e104f4d4920cf (patch) | |
tree | dbc3c61fd52623e78c3c6027c9ff061bf4016683 | |
parent | 9b53de492d72f106abb774b5fa568aa8efae21a1 (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.
-rw-r--r-- | common/vdlog.h | 8 |
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) { \ |