17#ifndef MBED_REALTIMECLOCK_H
18#define MBED_REALTIMECLOCK_H
21#include "hal/rtc_api.h"
43 using duration = std::chrono::seconds;
44 using rep = duration::rep;
45 using period = duration::period;
46 using time_point = std::chrono::time_point<RealTimeClock>;
47 static const bool is_steady =
false;
94 static time_point
now() noexcept
105 static void write(time_point t)
noexcept
117 return time_point{std::chrono::duration_cast<duration>(std::chrono::duration<time_t>{t})};
127 return std::chrono::duration_cast<std::chrono::duration<time_t>>(t.time_since_epoch()).count();
An implementation of a C++11 Clock representing the HAL real-time clock.
static time_t to_time_t(const time_point &t) noexcept
Convert a C++ Chrono time_point to a C time_t.
static void unlock()
Unlock the clock, allowing it to stop during power saving; dummy for API compatibility with HighResCl...
static time_point from_time_t(time_t t) noexcept
Convert a C time_t to C++ Chrono time_point.
static void lock()
Lock the clock to ensure it stays running; dummy for API compatibility with HighResClock.
static time_point now() noexcept
Get the current time from the RTC peripheral.
static void free()
Deinitialize RTC.
static bool isenabled() noexcept
Check if the RTC has the time set and is counting.
static void write(time_point t) noexcept
Write the current time in seconds to the RTC peripheral.
static void init()
Initialize the RTC peripheral.
time_t rtc_read(void)
Get the current time from the RTC peripheral.
int rtc_isenabled(void)
Check if the RTC has the time set and is counting.
void rtc_write(time_t t)
Write the current time in seconds to the RTC peripheral.
void rtc_init(void)
Initialize the RTC peripheral.
void rtc_free(void)
Deinitialize RTC.