From 23d5929c4a183e2f393887c817fd6c1bea4fe400 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 --- Jamroot.jam | 2 +- slicer/test/conversions.cpp | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Jamroot.jam b/Jamroot.jam index e02a59a..396dfd0 100644 --- a/Jamroot.jam +++ b/Jamroot.jam @@ -11,4 +11,4 @@ project ; -alias all : project2 netfs ytfs ; +alias all : project2 netfs libjsonpp p2pvr libtmdb slicer ; diff --git a/slicer/test/conversions.cpp b/slicer/test/conversions.cpp index a6c2c06..552135c 100644 --- a/slicer/test/conversions.cpp +++ b/slicer/test/conversions.cpp @@ -19,13 +19,16 @@ namespace Slicer { std::string dateTimeToString(const ::TestModule::DateTime & in) { - char buf[BUFSIZ]; - struct tm tm({ in.second, in.minute, in.hour, 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_sec = in.second; + tm.tm_min = in.minute; + tm.tm_hour = in.hour; + 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-%b-%d %H:%M:%S", &tm); return std::string(buf, len); } -- cgit v1.2.3