Lines Matching refs:time
25 #include <sys/time.h>
123 auto cmdTime = std::make_shared<TimeCmdParse>(std::vector<std::string>({ "-time" }),
124 "dump current time info,include localtime,timezone info",
138 "dump current time info,include localtime,timezone info",
163 "dump proxy delay time.",
168 "dump adjust time.",
433 bool TimeSystemAbility::IsValidTime(int64_t time)
436 if (time / MILLI_TO_BASE > LONG_MAX) {
443 bool TimeSystemAbility::SetRealTime(int64_t time)
445 if (!IsValidTime(time)) {
446 TIME_HILOGE(TIME_MODULE_SERVICE, "time is invalid: %{public}s", std::to_string(time).c_str());
456 " Set time: %{public}s"
459 std::to_string(beforeTime).c_str(), std::to_string(time).c_str(), std::to_string(time - bootTime).c_str(),
461 if (time < 0) {
462 TIME_HILOGE(TIME_MODULE_SERVICE, "input param error %{public}" PRId64 "", time);
471 tv.tv_sec = (time_t)(time / MILLI_TO_BASE);
472 tv.tv_usec = (suseconds_t)((time % MILLI_TO_BASE) * MILLI_TO_MICR);
475 TIME_HILOGE(TIME_MODULE_SERVICE, "settimeofday time fail: %{public}d. error: %{public}s", result,
485 if (currentTime < (time - ONE_MILLI) || currentTime > (time + ONE_MILLI)) {
492 int32_t TimeSystemAbility::SetTime(int64_t time, APIVersion apiVersion)
494 if (!SetRealTime(time)) {
519 dprintf(fd, "\n - dump all time info :\n");
529 dprintf(fd, " * date time = %s\n", date_time);
531 dprintf(fd, " * dump date time error.\n");
533 dprintf(fd, " - dump the time Zone:\n");
537 dprintf(fd, " * time zone = %s\n", timeZone.c_str());
539 dprintf(fd, " * dump time zone error,is %s\n", timeZone.c_str());
603 dprintf(fd, "\n - dump proxy delay time:\n");
659 TIME_HILOGE(TIME_MODULE_SERVICE, "convert rtc time failed: %{public}s", strerror(errno));
739 int32_t TimeSystemAbility::GetWallTimeMs(int64_t &time)
743 time = tv.tv_sec * MILLI_TO_BASE + tv.tv_nsec / NANO_TO_MILLI;
749 int32_t TimeSystemAbility::GetBootTimeMs(int64_t &time)
753 time = tv.tv_sec * MILLI_TO_BASE + tv.tv_nsec / NANO_TO_MILLI;
759 int32_t TimeSystemAbility::GetBootTimeNs(int64_t &time)
763 time = tv.tv_sec * NANO_TO_BASE + tv.tv_nsec;
769 int32_t TimeSystemAbility::GetThreadTimeMs(int64_t &time)
778 time = tv.tv_sec * MILLI_TO_BASE + tv.tv_nsec / NANO_TO_MILLI;
784 int32_t TimeSystemAbility::GetThreadTimeNs(int64_t &time)
793 time = tv.tv_sec * NANO_TO_BASE + tv.tv_nsec;
871 int32_t TimeSystemAbility::GetNtpTimeMs(int64_t &time)
873 auto ret = NtpUpdateTime::GetInstance().GetNtpTime(time);
881 int32_t TimeSystemAbility::GetRealTimeMs(int64_t &time)
883 auto ret = NtpUpdateTime::GetInstance().GetRealTime(time);