diff options
Diffstat (limited to 'libtmdb/conversions.cpp')
-rw-r--r-- | libtmdb/conversions.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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); } |