-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Setting a callback for SNTP time sync event [feature request] #7616
Comments
There is a 4:
|
Don't think it's "pity". It's just a new Arduino specific additional funcionality. Plus it don't breaks current API.
I checked again and you are right,
May be a solution, but don't think is "less invasive". If there are existing apps (I bet they are) that somehow relies on Anyway, any working solution will be appreciated. It should address problems like syncing with external RTC, setting time by the end user via some button/display interface etc. which were, and still are, discussed here on Github issues, Arduino forums and other places. |
Basic Infos
Platform
Settings in IDE
Problem Description
Function
settimeofday_cb()
sets a callback executed every time whensettimeofday()
is invoked. SNTP synchronization event change system time usingsettimeofday()
- which is ok, but if I runsettimeofday()
manually also callback function is invoked. There is no mechanism to show what was the source of callback - network synchronization or manual set.Expected Behavior
I can see at least three possible solutions:
bool
type variable which will be set to true if SNTP was a source of sync.settimeofday
-like function which do the same, but do not fire any callback.sntp_set_time_sync_notification_cb()
fromlwip/apps/sntp/sntp.c
which sets a callback ONLY for SNTP synchronization.Personally I prefer the 3rd one (only because I tested it in "plain" not "Arduino-based" ESP projects and works like a charm).
The text was updated successfully, but these errors were encountered: