helpers.cpp: add shortened strftime() function

taken from martiis neutrino-mp


Origin commit data
------------------
Branch: ni/coolstream
Commit: 672257906e
Author: vanhofen <vanhofen@gmx.de>
Date: 2014-05-29 (Thu, 29 May 2014)

Origin message was:
------------------
- helpers.cpp: add shortened strftime() function

 taken from martiis neutrino-mp


------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2014-05-29 22:26:30 +02:00
parent 23abd23c4a
commit 2e874500a6
4 changed files with 858 additions and 0 deletions

View File

@@ -390,6 +390,14 @@ std::string trim(std::string &str, const std::string &trimChars /*= " \n\r\t"*/)
return result.erase(0, result.find_first_not_of(trimChars));
}
std::string strftime(const char *format, const struct tm *tm)
{
char buf[4096];
*buf = 0;
strftime(buf, sizeof(buf), format, tm);
return std::string(buf);
}
time_t toEpoch(std::string &date)
{
struct tm t;