Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly wait for time to be picked up from NTP servers in setup #17

Open
matgrioni opened this issue Jan 25, 2020 · 2 comments
Open

Properly wait for time to be picked up from NTP servers in setup #17

matgrioni opened this issue Jan 25, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@matgrioni
Copy link
Contributor

matgrioni commented Jan 25, 2020

After configTime is called, we need to wait for this time to actually be initialized on the device, and so forth for every time we call it. This should be properly done, as opposed to one method I've seen of simply calling getLocalTime which internally waits for the time to be configured.

This can be found referenced in this issue, and also on this page.

@matgrioni matgrioni self-assigned this Jan 25, 2020
@matgrioni matgrioni added the enhancement New feature or request label Jan 25, 2020
@matgrioni matgrioni added this to the Preview Release (UDistrict) milestone Jan 25, 2020
@matgrioni
Copy link
Contributor Author

By default, std::time_t is equal to the uptime. So therefore, once this condition breaks, the time has been synced. This works for setup at least. After waking up from deep sleep, the logic will have to be more difficult, since there will be no baseline, but in either case the idea is the same. When the time has changed, the time has been brought in sync. I should only close this after updating the latest logic to work for all wake-up scenarios not just the latest one. Unfortunately, this logic will not work too well if the time is already accurate, in which case the behavior simply degenerates to the default wait period.

@matgrioni
Copy link
Contributor Author

There is apparently a sntp_set_time_sync_notification_cb method that already implemented and will most likely be released in the network platform update. This is a callback that is used whenever the time is changed or synchronized. However, for the moment, I will stick with the crude method as it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant