From 308b32c299df8bc66b27386ec89a030f0627d6b4 Mon Sep 17 00:00:00 2001 From: liulinna Date: Fri, 18 Mar 2022 17:01:02 +0800 Subject: [PATCH] testPR1 Signed-off-by: guduhanyan --- services/time_manager/src/ntp_update_time.cpp | 24 +++++++++---------- services/timer/src/timer_manager.cpp | 1 + 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/services/time_manager/src/ntp_update_time.cpp b/services/time_manager/src/ntp_update_time.cpp index f41ab0c..0fad895 100644 --- a/services/time_manager/src/ntp_update_time.cpp +++ b/services/time_manager/src/ntp_update_time.cpp @@ -64,20 +64,18 @@ void NtpUpdateTime::Init() } } if (autoTimeInfo_.status == NETWORK_TIME_STATUS_ON) { - SetSystemTime(); - } - - std::thread([this] { - for (int i = 0; i < MAX_RETRY; i++) { - if (!this->ThreadSetSystemTime()) { - TIME_HILOGE(TIME_MODULE_SERVICE, "thread set ntp time failed, retry"); - std::this_thread::sleep_for(seconds(MINUTES_TO_SECOND)); - } else { - TIME_HILOGD(TIME_MODULE_SERVICE, "thread set ntp time success"); - break; + std::thread([this] { + for (int i = 0; i < MAX_RETRY; i++) { + if (!this->ThreadSetSystemTime()) { + TIME_HILOGE(TIME_MODULE_SERVICE, "thread set ntp time failed, retry"); + std::this_thread::sleep_for(seconds(MINUTES_TO_SECOND)); + } else { + TIME_HILOGD(TIME_MODULE_SERVICE, "thread set ntp time success"); + break; + } } - } - }).detach(); + }).detach(); + } int32_t timerType = ITimerManager::TimerType::ELAPSED_REALTIME; auto callback = [this](uint64_t id) { diff --git a/services/timer/src/timer_manager.cpp b/services/timer/src/timer_manager.cpp index b7db6a9..7bcb98b 100644 --- a/services/timer/src/timer_manager.cpp +++ b/services/timer/src/timer_manager.cpp @@ -408,6 +408,7 @@ bool TimerManager::TriggerTimersLocked(std::vector> & auto alarm = batch->Get(i); alarm->count = 1; triggerList.push_back(alarm); + TIME_HILOGI(TIME_MODULE_SERVICE, "alarm uid= %{public}d", alarm->uid); if (alarm->repeatInterval > milliseconds::zero()) { alarm->count += duration_cast(nowElapsed - alarm->expectedWhenElapsed) / alarm->repeatInterval;