From e8cbe63d20fc21ffe643ac6a1febd41d8fb1e173 Mon Sep 17 00:00:00 2001 From: randomdan Date: Thu, 13 Nov 2014 00:27:16 +0000 Subject: Fix quirk (from glibc update?) around fields in struct tm and the _BSD_SOURCE macro --- libtmdb/conversions.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libtmdb') diff --git a/libtmdb/conversions.cpp b/libtmdb/conversions.cpp index 488419f..6df323d 100644 --- a/libtmdb/conversions.cpp +++ b/libtmdb/conversions.cpp @@ -8,13 +8,13 @@ namespace Slicer { std::string dateToString(const ::TMDb::Date & in) { - char buf[BUFSIZ]; - struct tm tm({ 0, 0, 0, in.Day, in.Month, in.Year, 0, 0, 0 -#ifdef _BSD_SOURCE - , 0, 0 -#endif - }); + struct tm tm; + memset(&tm, 0, sizeof(struct tm)); + tm.tm_mday = in.Day; + tm.tm_mon = in.Month; + tm.tm_year = in.Year; mktime(&tm); + char buf[BUFSIZ]; auto len = strftime(buf, BUFSIZ, "%Y-%m-%d", &tm); return std::string(buf, len); } -- cgit v1.2.3