|
@@ -46,7 +46,7 @@ public:
|
|
|
{
|
|
|
char _time[25] = {0};
|
|
|
time_t tt = std::chrono::system_clock::to_time_t(time);
|
|
|
- struct tm local_time;
|
|
|
+ struct tm local_time={0};
|
|
|
localtime_r(&tt, &local_time);
|
|
|
strftime(_time, 22, "%Y-%m-%d %H:%M:%S", &local_time);
|
|
|
|
|
@@ -64,7 +64,7 @@ public:
|
|
|
static time_t to_time(const std::string&str)
|
|
|
{
|
|
|
time_t t_;
|
|
|
- tm tm_;
|
|
|
+ tm tm_={0};
|
|
|
strptime(str.c_str(), "%Y-%m-%d %H:%M:%S", &tm_); //将字符串转换为tm时间
|
|
|
t_ = mktime(&tm_); //将tm时间转换为秒时间
|
|
|
|