Move in cpp

This commit is contained in:
Anton Sergunov 2024-05-09 02:52:27 +00:00
parent 87659ef22b
commit 2c5419bc28
2 changed files with 3 additions and 2 deletions

View file

@ -24,6 +24,8 @@ namespace sntp {
static const char *const TAG = "sntp";
std::vector<std::pair<optional<struct timeval>, sntp_sync_status_t>> callback_args_;
static std::function<void(struct timeval *tv)> g_sync_callback = nullptr;
void sntp_sync_time_cb(struct timeval *tv) { g_sync_callback(tv); }
@ -79,7 +81,7 @@ void SNTPComponent::update() {
#endif
}
void SNTPComponent::loop() {
for (const auto &item : this->callback_args_) {
for (const auto &item : callback_args_) {
switch (item.second) {
case SNTP_SYNC_STATUS_RESET:
ESP_LOGD(TAG, "Time sync reset");

View file

@ -32,7 +32,6 @@ class SNTPComponent : public time::RealTimeClock {
std::string server_2_;
std::string server_3_;
bool has_time_{false};
std::vector<std::pair<optional<struct timeval>, sntp_sync_status_t>> callback_args_;
};
} // namespace sntp