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

Marian Buschsieweke notifications at github.com
Mon Jul 26 18:37:02 CEST 2021

@maribu 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 don't like implementation specific APIs being exposed in the common header. IMO the following two alternatives should be taken:

1. Make this a feature and no longer specific to the `rtc_rtt` implementation
    - But does this API really make sense for hardware implementations? More likely a this could be a kind of convenience function on top of `rtc_set_time()` 
2. Move this to an `rtc_rtt.h` header

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/40915a98/attachment-0001.htm>

More information about the notifications mailing list