This PR enables the registration of time-change listeners. When the time is
set via a call to `os_settimeofday()`, all registered listeners are notified.
The following information gets passed to each listener:
```
struct os_time_change_info {
/** UTC time prior to change. */
const struct os_timeval *tci_prev_tv;
/** Time zone prior to change. */
const struct os_timezone *tci_prev_tz;
/** UTC time after change. */
const struct os_timeval *tci_cur_tv;
/** Time zone after change. */
const struct os_timezone *tci_cur_tz;
/** True if the time was not set prior to change. */
bool tci_newly_synced;
};
```
plus an optional listener-specific `void *arg`.
As indicated in the doxygen comments, the listener registration and removal
functions are not thread safe. In the typical case, I expect listeners to get
added at startup and never removed, so I didn't think adding thread-safety was
justified.
[ Full content available at: https://github.com/apache/mynewt-core/pull/1380 ]
This message was relayed via gitbox.apache.org for [email protected]