mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +02:00
move toEpoch to helpers.cpp, use strptime
This commit is contained in:
@@ -3574,17 +3574,6 @@ void CMovieBrowser::autoFindSerie(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static time_t toEpoch(std::string &date)
|
|
||||||
{
|
|
||||||
struct tm t;
|
|
||||||
memset(&t, 0, sizeof(t));
|
|
||||||
if (3 == sscanf(date.c_str(), "%d-%d-%d", &t.tm_year, &t.tm_mon, &t.tm_mday)) {
|
|
||||||
t.tm_year -= 1900;
|
|
||||||
t.tm_mon += 1;
|
|
||||||
return mktime(&t);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMovieBrowser::loadYTitles(int mode, std::string search, std::string id)
|
void CMovieBrowser::loadYTitles(int mode, std::string search, std::string id)
|
||||||
{
|
{
|
||||||
|
@@ -344,6 +344,18 @@ std::string trim(std::string &str, const std::string &trimChars /*= " \n\r\t"*/)
|
|||||||
return result.erase(0, result.find_first_not_of(trimChars));
|
return result.erase(0, result.find_first_not_of(trimChars));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
time_t toEpoch(std::string &date)
|
||||||
|
{
|
||||||
|
struct tm t;
|
||||||
|
memset(&t, 0, sizeof(t));
|
||||||
|
char *p = strptime(date.c_str(), "%Y-%m-%d", &t);
|
||||||
|
if(p)
|
||||||
|
return mktime(&t);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
CFileHelpers::CFileHelpers()
|
CFileHelpers::CFileHelpers()
|
||||||
{
|
{
|
||||||
FileBufSize = 0xFFFF;
|
FileBufSize = 0xFFFF;
|
||||||
|
@@ -47,6 +47,7 @@ std::string getFileName(std::string &file);
|
|||||||
std::string getFileExt(std::string &file);
|
std::string getFileExt(std::string &file);
|
||||||
std::string getNowTimeStr(const char* format);
|
std::string getNowTimeStr(const char* format);
|
||||||
std::string trim(std::string &str, const std::string &trimChars = " \n\r\t");
|
std::string trim(std::string &str, const std::string &trimChars = " \n\r\t");
|
||||||
|
time_t toEpoch(std::string &date);
|
||||||
|
|
||||||
class CFileHelpers
|
class CFileHelpers
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user