diff --git a/include/tools/otherTools.h b/include/tools/otherTools.h index 726c332b..4b7d2e18 100644 --- a/include/tools/otherTools.h +++ b/include/tools/otherTools.h @@ -45,6 +45,8 @@ namespace kiwix using MimeCounterType = std::map; MimeCounterType parseMimetypeCounter(const std::string& counterData); + + std::string gen_date_str(); } #endif diff --git a/src/opds_dumper.cpp b/src/opds_dumper.cpp index aff73898..2147e086 100644 --- a/src/opds_dumper.cpp +++ b/src/opds_dumper.cpp @@ -21,7 +21,6 @@ #include "book.h" #include "tools/otherTools.h" -#include namespace kiwix { @@ -35,22 +34,6 @@ OPDSDumper::~OPDSDumper() { } -std::string gen_date_str() -{ - auto now = time(0); - auto tm = localtime(&now); - - std::stringstream is; - is << std::setw(2) << std::setfill('0') - << 1900+tm->tm_year << "-" - << std::setw(2) << std::setfill('0') << tm->tm_mon+1 << "-" - << std::setw(2) << std::setfill('0') << tm->tm_mday << "T" - << std::setw(2) << std::setfill('0') << tm->tm_hour << ":" - << std::setw(2) << std::setfill('0') << tm->tm_min << ":" - << std::setw(2) << std::setfill('0') << tm->tm_sec << "Z"; - return is.str(); -} - static std::string gen_date_from_yyyy_mm_dd(const std::string& date) { std::stringstream is; diff --git a/src/tools/otherTools.cpp b/src/tools/otherTools.cpp index b5db9d49..a51ed5ff 100644 --- a/src/tools/otherTools.cpp +++ b/src/tools/otherTools.cpp @@ -19,6 +19,7 @@ #include "tools/otherTools.h" #include +#include #ifdef _WIN32 #include @@ -341,3 +342,19 @@ kiwix::MimeCounterType kiwix::parseMimetypeCounter(const std::string& counterDat return counters; } + +std::string kiwix::gen_date_str() +{ + auto now = std::time(0); + auto tm = std::localtime(&now); + + std::stringstream is; + is << std::setw(2) << std::setfill('0') + << 1900+tm->tm_year << "-" + << std::setw(2) << std::setfill('0') << tm->tm_mon+1 << "-" + << std::setw(2) << std::setfill('0') << tm->tm_mday << "T" + << std::setw(2) << std::setfill('0') << tm->tm_hour << ":" + << std::setw(2) << std::setfill('0') << tm->tm_min << ":" + << std::setw(2) << std::setfill('0') << tm->tm_sec << "Z"; + return is.str(); +}