add GetDateTimeSeconds

This commit is contained in:
aozhiwei 2018-12-11 17:28:12 +08:00
parent 71253c2b72
commit ab8a6b21f1
2 changed files with 9 additions and 0 deletions

View File

@ -185,6 +185,14 @@ namespace a8
return (time_val1 + g_time_zone*3600)/3600/24 - (time_val2 + g_time_zone*3600)/3600/24;
}
time_t GetDateTimeSeconds(const char* datetime_str)
{
struct tm stm;
strptime(datetime_str, "%Y-%m-%d %H:%M:%S", &stm);
long t = mktime(&stm);
return t;
}
long long MakeInt64(int low32, int high32)
{
return low32 + ((long long)high32 << 32);

View File

@ -67,6 +67,7 @@ namespace a8
std::string FormatDateTime(time_t time_val);
time_t GetDaySeconds(time_t time_val, int incdays = 0);
time_t BetweenDays(time_t time_val1, time_t time_val2);
time_t GetDateTimeSeconds(const char* datetime_str);
long long MakeInt64(int low32, int high32);
int Low32(long long int64_val);