mirror of
https://github.com/openharmony/miscservices_time.git
synced 2026-07-19 20:03:38 -04:00
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user