[riot-notifications] [RIOT-OS/RIOT] rtt_rtc: add rtc_settimeofday() & rtc_gettimeofday() (#16682)

benpicco notifications at github.com
Mon Jul 26 23:50:40 CEST 2021

@benpicco commented on this pull request.

> + * @param[in] s     The new epoch timestamp
+ * @param[in] us    Sub-Seconds
+ */
+void rtc_settimeofday(uint32_t s, uint32_t us);
+ * @brief Get the current epoch with sub-second precision
+ *        This feature is an extension provided by the `rtt_rtc` module.
+ *
+ * @note The actual µs precision depends on the underlying hardware.
+ *       The smallest time step will be 1 / @ref RTT_FREQUENCY.
+ *
+ * @param[out] s    The current epoch timestamp
+ * @param[out] us   Sub-Seconds
+ */
+void rtc_gettimeofday(uint32_t *s, uint32_t *us);

I think the second solution is the cleanest.
I really can't think of any *real* RTC that lets you *set* the sub-second component. 

There are some that expose the internal counter for reading, but won't let you mess with it.

If those show up in the future we can always move those functions back to `periph/rtc.h`. 

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210726/54e110c3/attachment.htm>

More information about the notifications mailing list