Signed-off-by: guduhanyan <xuyanjun27@163.com>
This commit is contained in:
liulinna
2022-03-18 17:01:02 +08:00
committed by guduhanyan
parent 3d817c6467
commit 308b32c299
2 changed files with 12 additions and 13 deletions
+11 -13
View File
@@ -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) {
+1
View File
@@ -408,6 +408,7 @@ bool TimerManager::TriggerTimersLocked(std::vector<std::shared_ptr<TimerInfo>> &
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<milliseconds>(nowElapsed -
alarm->expectedWhenElapsed) / alarm->repeatInterval;