diff options
author | randomdan <randomdan@localhost> | 2014-11-13 00:27:16 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2014-11-13 00:27:16 +0000 |
commit | 8e608a2f6f2a6f1e68dcc14e08424eb1130662be (patch) | |
tree | d31167e5711a3f519d56eb5f0e597d1aeba6d633 /slicer | |
parent | Write test data to the correct paths (diff) | |
download | slicer-8e608a2f6f2a6f1e68dcc14e08424eb1130662be.tar.bz2 slicer-8e608a2f6f2a6f1e68dcc14e08424eb1130662be.tar.xz slicer-8e608a2f6f2a6f1e68dcc14e08424eb1130662be.zip |
Fix quirk (from glibc update?) around fields in struct tm and the _BSD_SOURCE macroslicer-0.8.2
Diffstat (limited to 'slicer')
-rw-r--r-- | slicer/test/conversions.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
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); } |