PebbleOS
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
time.h File Reference
#include <pbl/util/time.h>
#include <stdbool.h>
#include <stdint.h>
#include <time.h>

Data Structures

struct  TimezoneInfo
 Timezone information, small enough to be kept in RTC registers. More...
 

Macros

#define DSTID_BRAZIL   6
 DST rule index of Brazil.
 
#define DSTID_LORDHOWE   20
 DST rule index of Lord Howe Island, whose DST offset is half an hour.
 

Functions

void time_get_timezone_abbr (char *out_buf, time_t utc_time)
 Get the timezone abbreviation in effect at a given time.
 
int32_t time_get_gmtoffset (void)
 Get the offset of the timezone from UTC, without DST.
 
bool time_get_isdst (time_t utc_time)
 Check whether a time falls within the DST period.
 
int32_t time_get_dstoffset (void)
 Get the offset added during DST.
 
time_t time_get_dst_start (void)
 Get the start of the DST period.
 
time_t time_utc_to_local (time_t utc_time)
 Convert UTC time, as returned by rtc_get_time(), to local time.
 
time_t time_local_to_utc (time_t local_time)
 Convert local time to UTC time.
 
void time_util_update_timezone (const TimezoneInfo *tz_info)
 Set the current timezone.
 
time_t time_util_get_midnight_of (time_t ts)
 Get the local midnight starting the day of a time.
 
bool time_util_range_spans_day (time_t start, time_t end, time_t start_of_day)
 Check whether a range covers a whole day.
 
time_t sys_time_utc_to_local (time_t t)
 Syscall wrapper of time_utc_to_local(), for unprivileged code.
 
time_t time_util_utc_to_local_offset (void)
 Get the current offset of local time from UTC, including DST.
 
uint16_t time_util_get_day (time_t utc_sec)
 Get the local day index of a time.
 
enum pbl_weekday time_util_get_day_in_week (time_t utc_sec)
 Get the local day of the week of a time.
 
int time_util_get_minute_of_day (time_t utc_sec)
 Get the local minute of the day of a time.
 
time_t time_start_of_today (void)
 Return the UTC time that corresponds to the start of today (midnight).
 
uint32_t time_get_uptime_seconds (void)
 Get the time since boot.