summaryrefslogtreecommitdiff
path: root/slicer
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2014-11-13 00:27:16 +0000
committerrandomdan <randomdan@localhost>2014-11-13 00:27:16 +0000
commit8e608a2f6f2a6f1e68dcc14e08424eb1130662be (patch)
treed31167e5711a3f519d56eb5f0e597d1aeba6d633 /slicer
parentWrite test data to the correct paths (diff)
downloadslicer-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.cpp15
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);
}