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

benpicco notifications at github.com
Mon Jul 26 16:53:21 CEST 2021

### Contribution description

The `rtt_rtc` module provided a RTC based on a RTT.
For some applications (e.g. NTP) it can be handy to set / get the epoch timestamp directly while still retaining the calendar alarm functionality.

This PR adds two functions `rtc_settimeofday()` and `rtc_gettimeofday()` to set/get the RTT timestamp with µs precision (rounded to the closest multiple of `1 /  RTT_FREQUENCY`).

### Testing procedure

The unit test in `unittests/tests-rtt_rtc` was extended to cover the new functionality. 

### Issues/PRs references

Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.

You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * rtt_rtc: add rtc_settimeofday() & rtc_gettimeofday()
  * unittests: rtt_rtc: add test for rtc_get/settimeofday()
  * rtt_rtc: fix rtc_get_time_ms()

-- File Changes --

    M drivers/include/periph/rtc.h (24)
    M drivers/rtt_rtc/rtt_rtc.c (32)
    M tests/unittests/tests-rtt_rtc/tests-rtt_rtc.c (25)

-- Patch Links --


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/cf33991e/attachment.htm>

More information about the notifications mailing list