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/time_manager/src/sntp_client.cpp b/services/time_manager/src/sntp_client.cpp index c849df5..9d2ca85 100644 --- a/services/time_manager/src/sntp_client.cpp +++ b/services/time_manager/src/sntp_client.cpp @@ -345,7 +345,7 @@ unsigned int SNTPClient::GetNtpField32(int offset, char* buffer) errno_t retValue = memcpy_s(&milliseconds, sizeof(int), valueRx, sizeof(int)); if (retValue != EOK) { TIME_HILOGE(TIME_MODULE_SERVICE, "memcpy_s failed, err = %d\n", retValue); - return false; // 返回失败 + return false; } TIME_HILOGD(TIME_MODULE_SERVICE, "end."); return milliseconds; diff --git a/services/time_manager/src/time_service.cpp b/services/time_manager/src/time_service.cpp index dc738c5..34c5cfc 100644 --- a/services/time_manager/src/time_service.cpp +++ b/services/time_manager/src/time_service.cpp @@ -306,14 +306,6 @@ bool TimeService::DestroyTimer(uint64_t timerId) int32_t TimeService::SetTime(const int64_t time) { - pid_t uid = IPCSkeleton::GetCallingUid(); - if (uid != 0) { - auto hasPerm = DelayedSingleton::GetInstance()->CheckCallingPermission(uid, setTimePermName_); - if (!hasPerm) { - TIME_HILOGE(TIME_MODULE_SERVICE, "Permission check failed, uid : %{public}d", uid); - return E_TIME_NO_PERMISSION; - } - } TIME_HILOGI(TIME_MODULE_SERVICE, "Setting time of day to milliseconds: %{public}" PRId64 "", time); if (time < 0 || time / 1000LL >= LONG_MAX) { TIME_HILOGE(TIME_MODULE_SERVICE, "input param error"); 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;