PebbleOS
Loading...
Searching...
No Matches
Macros | Typedefs | Functions
rtc.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <pbl/services/time.h>

Macros

#define RTC_TICKS_HZ   (1024u)
 Tick frequency in Hz.
 
#define TIME_STRING_BUFFER_SIZE   26
 Size of the buffers passed to rtc_get_time_string() and time_t_to_string().
 

Typedefs

typedef uint64_t RtcTicks
 RTC tick count.
 

Functions

void rtc_init (void)
 Initialize the RTC.
 
void rtc_calibrate_frequency (uint32_t frequency)
 Calibrate the RTC.
 
void rtc_init_timers (void)
 Start the timers the RTC driver needs.
 
bool rtc_sanitize_struct_tm (struct tm *t)
 Clamp the year of a broken-down time to 2000-2037.
 
bool rtc_sanitize_time_t (time_t *t)
 Clamp the year of a time to 2000-2037, as rtc_sanitize_struct_tm().
 
void rtc_set_time (time_t time)
 Set the current time.
 
time_t rtc_get_time (void)
 Get the current time.
 
void rtc_set_time_tm (struct tm *time_tm)
 Set the current time from a broken-down time.
 
void rtc_get_time_tm (struct tm *time_tm)
 Get the current time as a broken-down local time.
 
void rtc_get_time_ms (time_t *out_seconds, uint16_t *out_ms)
 Get the current time with millisecond resolution.
 
void rtc_set_timezone (TimezoneInfo *tzinfo)
 Store the timezone in storage that survives reboots.
 
void rtc_get_timezone (TimezoneInfo *tzinfo)
 Load the stored timezone.
 
uint16_t rtc_get_timezone_id (void)
 Get the stored timezone region ID.
 
bool rtc_is_timezone_set (void)
 Check whether a timezone is stored.
 
const char * rtc_get_time_string (char *buffer)
 Format the current local time.
 
RtcTicks rtc_get_ticks (void)
 Get the tick count.
 
void rtc_alarm_init (void)
 Initialize the RTC alarm, used to wake from stop mode.
 
void rtc_alarm_set (RtcTicks num_ticks)
 Arm the alarm.
 
void rtc_timezone_clear (void)
 Clear the stored timezone, as part of a factory reset.
 
RtcTicks rtc_alarm_get_elapsed_ticks (void)
 Get the ticks elapsed since the alarm was last set.
 
bool rtc_alarm_is_initialized (void)
 Check whether the alarm is initialized.
 
const char * time_t_to_string (char *buffer, time_t t)
 Format a time as local time.