Add sntp synced event

#1

Hi,

I would like to emit an event like “SNTP_SYNCED” by patching the mgos_sntp.c file. Please let me know if it is already implemented somewhere else, or it is not a good place to do it.

Thanks,
Michael

#2

There is already MGOS_EVENT_TIME_CHANGED which is trigerred when the sntp lib synchronizes with a time server

1 Like
#3

Thanks! That will do. I studied the api_events.js and did not think it also means sntp synced.

// ## **`Event.OTA_STATUS`**
// System event which is triggered when OTA status changes.
//
// In the callback, use `OTA.evdataOtaStatusMsg(evdata)` from `api_ota.js` to
// get the OTA status message.
Event.OTA_TIME_CHANGED = Event.SYS + 3;
#4

Event.SYS + 3 is MGOS_EVENT_TIME_CHANGED.
The comments and the definition should be changed to reflect the real meaning of the event.