From cff060099a5f2e9c2b70ff7e0d4e251027575677 Mon Sep 17 00:00:00 2001 From: gaojiaqi Date: Mon, 13 May 2024 11:40:41 +0800 Subject: [PATCH] refactor reminder calendar Signed-off-by: gaojiaqi --- .../ans/src/reminder_request_calendar.cpp | 483 +++++++++--------- .../inner_api/reminder_request_calendar.h | 167 +++--- 2 files changed, 343 insertions(+), 307 deletions(-) diff --git a/frameworks/ans/src/reminder_request_calendar.cpp b/frameworks/ans/src/reminder_request_calendar.cpp index dd43debd4..2700f8968 100644 --- a/frameworks/ans/src/reminder_request_calendar.cpp +++ b/frameworks/ans/src/reminder_request_calendar.cpp @@ -25,7 +25,24 @@ namespace OHOS { namespace Notification { const uint8_t ReminderRequestCalendar::DEFAULT_SNOOZE_TIMES = 3; -const uint8_t ReminderRequestCalendar::DAY_ARRAY[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; +const uint8_t ReminderRequestCalendar::DAY_ARRAY[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + +static inline bool ConvertStrToJson(const std::string &str, nlohmann::json &root) +{ + if (str.empty()) { + return false; + } + if (!nlohmann::json::accept(str)) { + ANSR_LOGW("input not a json string!"); + return false; + } + root = nlohmann::json::parse(str, nullptr, false); + if (root.is_discarded()) { + ANSR_LOGW("parse json data failed!"); + return false; + } + return true; +} ReminderRequestCalendar::ReminderRequestCalendar(const tm &dateTime, const std::vector &repeatMonths, const std::vector &repeatDays, const std::vector &daysOfWeek) @@ -46,18 +63,9 @@ ReminderRequestCalendar::ReminderRequestCalendar(const tm &dateTime, const std:: ReminderRequestCalendar::ReminderRequestCalendar(const ReminderRequestCalendar &other) : ReminderRequest(other) { - dateTime_ = other.dateTime_; firstDesignateYear_ = other.firstDesignateYear_; firstDesignateMonth_ = other.firstDesignateMonth_; firstDesignateDay_ = other.firstDesignateDay_; - year_ = other.year_; - month_ = other.month_; - day_ = other.day_; - hour_ = other.hour_; - minute_ = other.minute_; - second_ = other.second_; - repeatMonth_ = other.repeatMonth_; - repeatDay_ = other.repeatDay_; repeatDaysOfWeek_ = other.repeatDaysOfWeek_; rruleWantAgentInfo_ = other.rruleWantAgentInfo_; durationTime_ = other.durationTime_; @@ -71,6 +79,11 @@ void ReminderRequestCalendar::SetRRuleWantAgentInfo(const std::shared_ptr ReminderRequestCalendar::GetRRuleWantAgentInfo() const +{ + return rruleWantAgentInfo_; +} + void ReminderRequestCalendar::AddExcludeDate(const uint64_t date) { time_t t = static_cast(date / MILLI_SECONDS); @@ -101,6 +114,226 @@ std::vector ReminderRequestCalendar::GetExcludeDates() const return excludeDates; } +void ReminderRequestCalendar::SetFirstDesignateYear(const uint16_t year) +{ + firstDesignateYear_ = year; +} + +void ReminderRequestCalendar::SetFirstDesignageMonth(const uint16_t month) +{ + firstDesignateMonth_ = month; +} + +void ReminderRequestCalendar::SetFirstDesignateDay(const uint16_t day) +{ + firstDesignateDay_ = day; +} + +void ReminderRequestCalendar::SetDateTime(const uint64_t time) +{ + startDateTime_ = time; +} + +void ReminderRequestCalendar::SetEndDateTime(const uint64_t time) +{ + endDateTime_ = std::max(time, startDateTime_); + durationTime_ = endDateTime_ - startDateTime_; +} + +std::string ReminderRequestCalendar::SerializationRRule() +{ + constexpr int32_t INDENT = -1; + if (rruleWantAgentInfo_ == nullptr) { + return ""; + } + nlohmann::json root; + root["pkgName"] = rruleWantAgentInfo_->pkgName; + root["abilityName"] = rruleWantAgentInfo_->abilityName; + root["uri"] = rruleWantAgentInfo_->uri; + std::string str = root.dump(INDENT, ' ', false, nlohmann::json::error_handler_t::replace); + return str; +} + +std::string ReminderRequestCalendar::SerializationExcludeDates() +{ + constexpr int32_t INDENT = -1; + nlohmann::json root; + root["excludeDates"] = nlohmann::json::array(); + for (auto date : excludeDates_) { + root["excludeDates"].push_back(date); + } + std::string str = root.dump(INDENT, ' ', false, nlohmann::json::error_handler_t::replace); + return str; +} + +void ReminderRequestCalendar::DeserializationRRule(const std::string& str) +{ + nlohmann::json root; + if (!ConvertStrToJson(str, root)) { + return; + } + if (!root.contains("pkgName") || !root["pkgName"].is_string() || + !root.contains("abilityName") || !root["abilityName"].is_string() || + !root.contains("uri") || !root["uri"].is_string()) { + return; + } + rruleWantAgentInfo_ = std::make_shared(); + rruleWantAgentInfo_->pkgName = root["pkgName"].get(); + rruleWantAgentInfo_->abilityName = root["abilityName"].get(); + rruleWantAgentInfo_->uri = root["uri"].get(); +} + +void ReminderRequestCalendar::DeserializationExcludeDates(const std::string& str) +{ + nlohmann::json root; + if (!ConvertStrToJson(str, root)) { + return; + } + if (!root.contains("excludeDates") || !root["excludeDates"].is_array()) { + return; + } + excludeDates_.clear(); + for (auto date : root["excludeDates"]) { + if (date.is_number()) { + excludeDates_.insert(date.get()); + } + } +} + +bool ReminderRequestCalendar::UpdateNextReminder() +{ + ANSR_LOGD("UpdateNextReminder calendar time"); + if (!IsRepeatReminder()) { + ANSR_LOGI("No need to update next trigger time as it is an one-time reminder."); + SetSnoozeTimesDynamic(GetSnoozeTimes()); + SetExpired(true); + return false; + } + uint8_t leftSnoozeTimes = GetSnoozeTimesDynamic(); + if (leftSnoozeTimes > 0 && (GetTimeInterval() > 0)) { + ANSR_LOGI("Left snooze times: %{public}d, update next triggerTime", leftSnoozeTimes); + SetTriggerTimeInMilli(GetTriggerTimeInMilli() + GetTimeInterval() * MILLI_SECONDS); + SetSnoozeTimesDynamic(--leftSnoozeTimes); + } else { + SetSnoozeTimesDynamic(GetSnoozeTimes()); + if ((repeatMonth_ == 0 || repeatDay_ == 0) && (repeatDaysOfWeek_ == 0)) { + ANSR_LOGI("Not a day repeat reminder, no need to update to next trigger time."); + SetExpired(true); + return false; + } else { + uint64_t nextTriggerTime = GetNextTriggerTime(); + if (nextTriggerTime != INVALID_LONG_LONG_VALUE) { + ANSR_LOGI("Set next trigger time successful, reset dynamic snoozeTimes"); + SetTriggerTimeInMilli(nextTriggerTime); + } else { + ANSR_LOGW("Set next trigger time invalidate"); + SetExpired(true); + return false; + } + } + } + return true; +} + +bool ReminderRequestCalendar::OnDateTimeChange() +{ + if (IsExpired()) { + return false; + } + uint64_t now = GetNowInstantMilli(); + if (now == 0) { + ANSR_LOGE("get now time failed"); + return false; + } + if (CheckCalenderIsExpired(now)) { + return true; + } else { + uint64_t triggerTime = GetNextTriggerTime(); + SetTriggerTimeInMilli(triggerTime); + return false; + } +} + +bool ReminderRequestCalendar::IsRepeat() const +{ + return (repeatMonth_ > 0 && repeatDay_ > 0) || (repeatDaysOfWeek_ > 0); +} + +bool ReminderRequestCalendar::CheckExcludeDate() +{ + if (!IsRepeat()) { + // not repeat reminder + return false; + } + + if (IsInExcludeDate()) { + // in exclude date + uint64_t triggerTime = GetNextTriggerTime(); + SetTriggerTimeInMilli(triggerTime); + return true; + } + return false; +} + +void ReminderRequestCalendar::InitDateTime(const tm &dateTime) +{ + time_t time = mktime(&dateTime_); + if (time == -1) { + startDateTime_ = 0; + } else { + startDateTime_ = ReminderRequest::GetDurationSinceEpochInMilli(time); + endDateTime_ = startDateTime_; + } +} + +void ReminderRequestCalendar::SetDay(const uint8_t day, const bool isSet) +{ + if (day < 1 || day > MAX_DAYS_OF_MONTH) { + return; + } + if (isSet) { + repeatDay_ |= 1 << (day - 1); + } else { + repeatDay_ &= ~(1 << (day - 1)); + } +} + +void ReminderRequestCalendar::SetMonth(const uint8_t month, const bool isSet) +{ + if (month < JANUARY || month > DECEMBER) { + return; + } + if (isSet) { + repeatMonth_ |= 1 << (month - 1); + } else { + repeatMonth_ &= ~ (1 << (month - 1)); + } +} + +void ReminderRequestCalendar::SetRepeatMonths(const std::vector &repeatMonths) +{ + if (repeatMonths.size() > MAX_MONTHS_OF_YEAR) { + ANSR_LOGW("The length of repeat months array should not larger than %{public}hhu", MAX_MONTHS_OF_YEAR); + return; + } + repeatMonth_ = 0; + for (const auto month : repeatMonths) { + SetMonth(month, true); + } +} + +void ReminderRequestCalendar::SetRepeatDaysOfMonth(const std::vector &repeatDays) +{ + if (repeatDays.size() > MAX_DAYS_OF_MONTH) { + ANSR_LOGW("The length of repeat days array should not larger than %{public}hhu", MAX_DAYS_OF_MONTH); + return; + } + repeatDay_ = 0; + for (const auto day : repeatDays) { + SetDay(day, true); + } +} + bool ReminderRequestCalendar::IsInExcludeDate() const { time_t t = static_cast(startDateTime_ / MILLI_SECONDS); @@ -122,10 +355,8 @@ bool ReminderRequestCalendar::IsInExcludeDate() const return false; } -std::shared_ptr ReminderRequestCalendar::GetRRuleWantAgentInfo() -{ - return rruleWantAgentInfo_; -} + + bool ReminderRequestCalendar::InitTriggerTime() { @@ -226,46 +457,6 @@ bool ReminderRequestCalendar::CheckCalenderIsExpired(const uint64_t now) return false; } -bool ReminderRequestCalendar::OnDateTimeChange() -{ - if (IsExpired()) { - return false; - } - uint64_t now = GetNowInstantMilli(); - if (now == 0) { - ANSR_LOGE("get now time failed"); - return false; - } - if (CheckCalenderIsExpired(now)) { - return true; - } else { - uint64_t triggerTime = GetNextTriggerTime(); - SetTriggerTimeInMilli(triggerTime); - return false; - } -} - -bool ReminderRequestCalendar::IsRepeat() const -{ - return (repeatMonth_ > 0 && repeatDay_ > 0) || (repeatDaysOfWeek_ > 0); -} - -bool ReminderRequestCalendar::CheckExcludeDate() -{ - if (!IsRepeat()) { - // not repeat reminder - return false; - } - - if (IsInExcludeDate()) { - // in exclude date - uint64_t triggerTime = GetNextTriggerTime(); - SetTriggerTimeInMilli(triggerTime); - return true; - } - return false; -} - uint64_t ReminderRequestCalendar::GetNextTriggerTime() { uint64_t triggerTimeInMilli = INVALID_LONG_LONG_VALUE; @@ -375,32 +566,6 @@ void ReminderRequestCalendar::InitDateTime() dateTime_.tm_isdst = -1; } -void ReminderRequestCalendar::InitDateTime(const tm &dateTime) -{ - dateTime_.tm_year = dateTime.tm_year; - dateTime_.tm_mon = dateTime.tm_mon; - dateTime_.tm_mday = dateTime.tm_mday; - dateTime_.tm_hour = dateTime.tm_hour; - dateTime_.tm_min = dateTime.tm_min; - dateTime_.tm_sec = dateTime.tm_sec; - dateTime_.tm_isdst = -1; - - year_ = static_cast(GetActualTime(TimeTransferType::YEAR, dateTime.tm_year)); - month_ = static_cast(GetActualTime(TimeTransferType::MONTH, dateTime.tm_mon)); - day_ = static_cast(dateTime.tm_mday); - hour_ = static_cast(dateTime.tm_hour); - minute_ = static_cast(dateTime.tm_min); - second_ = static_cast(dateTime.tm_sec); - - time_t time = mktime(&dateTime_); - if (time == -1) { - startDateTime_ = 0; - } else { - startDateTime_ = ReminderRequest::GetDurationSinceEpochInMilli(time); - endDateTime_ = startDateTime_; - } -} - bool ReminderRequestCalendar::IsRepeatReminder() const { return (repeatMonth_ > 0 && repeatDay_ > 0) || (repeatDaysOfWeek_ > 0) @@ -423,54 +588,6 @@ bool ReminderRequestCalendar::IsRepeatDay(uint8_t day) const return (repeatDay_ & (1 << (day - 1))) > 0; } -void ReminderRequestCalendar::SetDay(const uint8_t &day, const bool &isSet) -{ - if (day < 1 || day > MAX_DAYS_OF_MONTH) { - return; - } - if (isSet) { - repeatDay_ |= 1 << (day - 1); - } else { - repeatDay_ &= ~(1 << (day - 1)); - } -} - -void ReminderRequestCalendar::SetMonth(const uint8_t &month, const bool &isSet) -{ - if (month < JANUARY || month > DECEMBER) { - return; - } - if (isSet) { - repeatMonth_ |= 1 << (month - 1); - } else { - repeatMonth_ &= ~ (1 << (month - 1)); - } -} - -void ReminderRequestCalendar::SetRepeatMonths(const std::vector &repeatMonths) -{ - if (repeatMonths.size() > MAX_MONTHS_OF_YEAR) { - ANSR_LOGW("The length of repeat months array should not larger than %{public}hhu", MAX_MONTHS_OF_YEAR); - return; - } - repeatMonth_ = 0; - for (auto it = repeatMonths.begin(); it != repeatMonths.end(); ++it) { - SetMonth((*it), true); - } -} - -void ReminderRequestCalendar::SetRepeatDaysOfMonth(const std::vector &repeatDays) -{ - if (repeatDays.size() > MAX_DAYS_OF_MONTH) { - ANSR_LOGW("The length of repeat days array should not larger than %{public}hhu", MAX_DAYS_OF_MONTH); - return; - } - repeatDay_ = 0; - for (auto it = repeatDays.begin(); it != repeatDays.end(); ++it) { - SetDay((*it), true); - } -} - std::vector ReminderRequestCalendar::GetRepeatMonths() const { std::vector repeatMonths; @@ -493,41 +610,6 @@ std::vector ReminderRequestCalendar::GetRepeatDays() const return repeatDays; } -bool ReminderRequestCalendar::UpdateNextReminder() -{ - ANSR_LOGD("UpdateNextReminder calendar time"); - if (!IsRepeatReminder()) { - ANSR_LOGI("No need to update next trigger time as it is an one-time reminder."); - SetSnoozeTimesDynamic(GetSnoozeTimes()); - SetExpired(true); - return false; - } - uint8_t leftSnoozeTimes = GetSnoozeTimesDynamic(); - if (leftSnoozeTimes > 0 && (GetTimeInterval() > 0)) { - ANSR_LOGI("Left snooze times: %{public}d, update next triggerTime", leftSnoozeTimes); - SetTriggerTimeInMilli(GetTriggerTimeInMilli() + GetTimeInterval() * MILLI_SECONDS); - SetSnoozeTimesDynamic(--leftSnoozeTimes); - } else { - SetSnoozeTimesDynamic(GetSnoozeTimes()); - if ((repeatMonth_ == 0 || repeatDay_ == 0) && (repeatDaysOfWeek_ == 0)) { - ANSR_LOGI("Not a day repeat reminder, no need to update to next trigger time."); - SetExpired(true); - return false; - } else { - uint64_t nextTriggerTime = GetNextTriggerTime(); - if (nextTriggerTime != INVALID_LONG_LONG_VALUE) { - ANSR_LOGI("Set next trigger time successful, reset dynamic snoozeTimes"); - SetTriggerTimeInMilli(nextTriggerTime); - } else { - ANSR_LOGW("Set next trigger time invalidate"); - SetExpired(true); - return false; - } - } - } - return true; -} - uint64_t ReminderRequestCalendar::PreGetNextTriggerTimeIgnoreSnooze(bool ignoreRepeat, bool forceToGetNext) { if (ignoreRepeat || (repeatMonth_ > 0 && repeatDay_ > 0) || (repeatDaysOfWeek_ > 0)) { @@ -783,80 +865,5 @@ uint64_t ReminderRequestCalendar::GetEndDateTime() return endDateTime_; } -std::string ReminderRequestCalendar::SerializationRRule() -{ - constexpr int32_t INDENT = -1; - if (rruleWantAgentInfo_ == nullptr) { - return ""; - } - nlohmann::json root; - root["pkgName"] = rruleWantAgentInfo_->pkgName; - root["abilityName"] = rruleWantAgentInfo_->abilityName; - root["uri"] = rruleWantAgentInfo_->uri; - std::string str = root.dump(INDENT, ' ', false, nlohmann::json::error_handler_t::replace); - return str; -} - -std::string ReminderRequestCalendar::SerializationExcludeDates() -{ - constexpr int32_t INDENT = -1; - nlohmann::json root; - root["excludeDates"] = nlohmann::json::array(); - for (auto date : excludeDates_) { - root["excludeDates"].push_back(date); - } - std::string str = root.dump(INDENT, ' ', false, nlohmann::json::error_handler_t::replace); - return str; -} - -void ReminderRequestCalendar::DeserializationRRule(const std::string& str) -{ - if (str.empty()) { - return; - } - if (!nlohmann::json::accept(str)) { - ANSR_LOGW("not a json string!"); - return; - } - nlohmann::json root = nlohmann::json::parse(str, nullptr, false); - if (root.is_discarded()) { - ANSR_LOGW("parse json data failed!"); - return; - } - if (!root.contains("pkgName") || !root["pkgName"].is_string() || - !root.contains("abilityName") || !root["abilityName"].is_string() || - !root.contains("uri") || !root["uri"].is_string()) { - return; - } - - rruleWantAgentInfo_ = std::make_shared(); - rruleWantAgentInfo_->pkgName = root["pkgName"].get(); - rruleWantAgentInfo_->abilityName = root["abilityName"].get(); - rruleWantAgentInfo_->uri = root["uri"].get(); -} - -void ReminderRequestCalendar::DeserializationExcludeDates(const std::string& str) -{ - if (str.empty()) { - return; - } - if (!nlohmann::json::accept(str)) { - return; - } - nlohmann::json root = nlohmann::json::parse(str, nullptr, false); - if (root.is_discarded()) { - return; - } - - if (!root.contains("excludeDates") || !root["excludeDates"].is_array()) { - return; - } - excludeDates_.clear(); - for (auto date : root["excludeDates"]) { - if (date.is_number()) { - excludeDates_.insert(date.get()); - } - } -} } } diff --git a/interfaces/inner_api/reminder_request_calendar.h b/interfaces/inner_api/reminder_request_calendar.h index fcd97dd09..569fe7339 100644 --- a/interfaces/inner_api/reminder_request_calendar.h +++ b/interfaces/inner_api/reminder_request_calendar.h @@ -58,21 +58,94 @@ public: * * @param reminderId Indicates reminder id. */ - explicit ReminderRequestCalendar(int32_t reminderId) : ReminderRequest(reminderId) {}; - + explicit ReminderRequestCalendar(int32_t reminderId) : ReminderRequest(reminderId) {} explicit ReminderRequestCalendar(const ReminderRequestCalendar &other); ReminderRequestCalendar& operator = (const ReminderRequestCalendar &other); ~ReminderRequestCalendar() override {} +public: void SetRRuleWantAgentInfo(const std::shared_ptr &wantAgentInfo); - - std::shared_ptr GetRRuleWantAgentInfo(); + std::shared_ptr GetRRuleWantAgentInfo() const; void AddExcludeDate(const uint64_t date); void DelExcludeDates(); std::vector GetExcludeDates() const; + + void SetFirstDesignateYear(const uint16_t year); + uint16_t GetFirstDesignateYear() const + { + return firstDesignateYear_; + } + void SetFirstDesignageMonth(const uint16_t month); + uint16_t GetFirstDesignageMonth() const + { + return firstDesignateMonth_; + } + void SetFirstDesignateDay(const uint16_t day); + uint16_t GetFirstDesignateDay() const + { + return firstDesignateDay_; + } + + void SetDateTime(const uint64_t time); + uint64_t GetDateTime() const + { + return startDateTime_; + } + void SetEndDateTime(const uint64_t time); + uint64_t GetEndDateTime() const + { + return endDateTime_; + } + + uint32_t GetRepeatDay() const + { + return repeatDay_; + } + uint16_t GetRepeatMonth() const + { + return repeatMonth_; + } + + std::string SerializationRRule(); + std::string SerializationExcludeDates(); + void DeserializationRRule(const std::string& str); + void DeserializationExcludeDates(const std::string& str); + +public: + bool UpdateNextReminder() override; + bool OnDateTimeChange() override; + + /** + * @brief Check reminder request is repeat + */ + bool IsRepeat() const override; + + /** + * @brief Check reminder request is in exclude date + */ + bool CheckExcludeDate() override; + +private: + /** + * @brief Init start date time. + */ + void InitDateTime(const tm &dateTime); + + /** + * @brief Set repeat months days. + */ + void SetDay(const uint8_t day, const bool isSet); + void SetMonth(const uint8_t month, const bool isSet); + void SetRepeatMonths(const std::vector &repeatMonths); + void SetRepeatDaysOfMonth(const std::vector &repeatDays); + + /** + * @brief Check start date time is in exclude dates. + */ bool IsInExcludeDate() const; +public: inline uint16_t GetYear() const { return year_; @@ -103,38 +176,12 @@ public: return second_; } - inline uint16_t GetFirstDesignateYear() const - { - return firstDesignateYear_; - } - - inline uint16_t GetFirstDesignageMonth() const - { - return firstDesignateMonth_; - } - - inline uint16_t GetFirstDesignateDay() const - { - return firstDesignateDay_; - } - bool InitTriggerTime(); std::vector GetRepeatMonths() const; std::vector GetRepeatDays() const; - virtual bool UpdateNextReminder() override; - virtual bool OnDateTimeChange() override; - /** - * @brief Check reminder request is repeat - */ - bool IsRepeat() const override; - - /** - * @brief Check reminder request is in exclude date - */ - bool CheckExcludeDate() override; /** * Marshal a reminder object into a Parcel. @@ -181,14 +228,7 @@ private: uint8_t GetNextDay(const uint16_t &settedYear, const uint8_t &settedMonth, const tm &now, const tm &target) const; uint64_t GetNextTriggerTime(); uint64_t GetNextTriggerTimeAsRepeatReminder(const tm &nowTime, const tm &tarTime) const; - uint32_t GetRepeatDay() const - { - return repeatDay_; - } - uint16_t GetRepeatMonth() const - { - return repeatMonth_; - } + uint64_t GetTimeInstantMilli( uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second) const; @@ -196,49 +236,38 @@ private: * @brief Init dateTime_ when read from parcel. */ void InitDateTime(); - void InitDateTime(const tm &dateTime); bool IsRepeatReminder() const; bool IsRepeatMonth(uint8_t month) const; bool IsRepeatDay(uint8_t day) const; - void SetDay(const uint8_t &day, const bool &isSet); - void SetMonth(const uint8_t &month, const bool &isSet); - void SetRepeatMonths(const std::vector &repeatMonths); - void SetRepeatDaysOfMonth(const std::vector &repeatDays); bool CheckCalenderIsExpired(const uint64_t now); - void SetDateTime(const uint64_t time); - uint64_t GetDateTime(); - uint64_t GetEndDateTime(); - std::string SerializationRRule(); - std::string SerializationExcludeDates(); - void DeserializationRRule(const std::string& str); - void DeserializationExcludeDates(const std::string& str); + static const uint8_t DEFAULT_SNOOZE_TIMES; - tm dateTime_ = { - .tm_sec = 0, - .tm_min = 0, - .tm_hour = 0, - .tm_mday = 1, - .tm_mon = 0, - .tm_year = 0, - .tm_wday = 0, - .tm_yday = 0, - .tm_isdst = -1 - }; + // tm dateTime_ = { + // .tm_sec = 0, + // .tm_min = 0, + // .tm_hour = 0, + // .tm_mday = 1, + // .tm_mon = 0, + // .tm_year = 0, + // .tm_wday = 0, + // .tm_yday = 0, + // .tm_isdst = -1 + // }; uint16_t firstDesignateYear_ {1}; uint8_t firstDesignateMonth_ {1}; uint8_t firstDesignateDay_ {1}; - uint16_t year_ {1}; - uint8_t month_ {1}; - uint8_t day_ {1}; - uint8_t hour_ {1}; - uint8_t minute_ {1}; - uint8_t second_ {0}; - uint16_t repeatMonth_ {0}; - uint32_t repeatDay_ {0}; + // uint16_t year_ {1}; + // uint8_t month_ {1}; + // uint8_t day_ {1}; + // uint8_t hour_ {1}; + // uint8_t minute_ {1}; + // uint8_t second_ {0}; + // uint16_t repeatMonth_ {0}; + // uint32_t repeatDay_ {0}; uint64_t startDateTime_{0}; uint64_t endDateTime_{0}; -- Gitee