int hour = g_motionTimes / NUM_TIME_HOUR;
int min = (g_motionTimes % NUM_TIME_HOUR) / NUM_TIME_MIN;
int sec = (g_motionTimes % NUM_TIME_HOUR) % NUM_TIME_MIN;
- // PRINT("ostringstream is end!\r\n");
+
std::ostringstream oss;
oss << std::setfill('0') << std::setw(2) << hour << ":" << std::setw(2) << min << ":" << std::setw(2) << sec;
- // PRINT("motionDuration is end!\r\n");
+
motionDuration = oss.str();
- // PRINT("DisplayMotionDuration is end!\r\n");
return motionDuration;
}
#ifdef __cplusplus
/*更新当前时间*/
void TrainingDataView::UpdataTime()
{
+ if (curtimelabel == nullptr) // 防止刷新空组件
+ return;
+
// 获取当前时间
struct tm pTM;
time_t seconds;
// 将时间和日期转换为字符串
std::string stringtime = (hour < 10 ? "0" : "") + std::to_string(hour) + ":" + (minute < 10 ? "0" : "") + std::to_string(minute);
curtimelabel->SetText(stringtime.c_str());
+ PRINT("curtimelabel!\r\n");
}
}