From: penglei <1624952103@qq.com> Date: Thu, 29 Aug 2024 03:21:50 +0000 (+0800) Subject: 优化睡眠状态时间戳计算 X-Git-Tag: release_V1.2.70_20241020_135402~549^2~11 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F820%2Fhead;p=mirrors%2FFD230.git 优化睡眠状态时间戳计算 --- diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index 2cd458c82..3ee6db719 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -1205,9 +1205,9 @@ void MsgCenterNotifyInactivityProc(const Topic topic, Request *req) WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyInactivityProc !"); //unused(topic); #ifdef FD230 + uint32_t timestamp = 0; if(day_timestamp == 0) { - uint32_t timestamp = 0; time_t rawtime; struct tm* timeinfo; time(&rawtime); @@ -1274,7 +1274,11 @@ void MsgCenterNotifyInactivityProc(const Topic topic, Request *req) { sleep_data.sleep_status[state_num].timestamp = day_timestamp + cywee_Inactivity_Info->hour * 60 * 60 + cywee_Inactivity_Info->minute * 60; sleep_data.sleep_status[state_num].stat = cywee_Inactivity_Info->status; - + if(sleep_data.sleep_status[state_num].stat == 6 || sleep_data.sleep_status[state_num].stat == 13) + { + uapi_get_timestampe_ss(×tamp); + sleep_data.sleep_status[state_num].timestamp = timestamp; + } if(sleep_data.sleep_status[state_num].stat == 0) //0进入睡眠 1潜睡 2深睡 3清醒 4结束睡眠 6入睡 7出睡最后一笔输出 8未出睡最后一笔输出 12快速动眼 13取消入睡 { sleep_data.fall_asleep_timestamp = sleep_data.sleep_status[state_num].timestamp;