PebbleOS v4.47.0-512-g5285d4236
Loading...
Searching...
No Matches
Wall Time

Functions, data structures and other things related to wall clock time. More...

Macros

#define TIMEZONE_NAME_LENGTH   32
 The maximum length for a timezone full name (e.g.
 
#define TIME_STRING_BUFFER_SIZE   26
 Size of the buffers passed to time_t_to_string().
 

Enumerations

enum  WeekDay {
  TODAY = 0 , SUNDAY , MONDAY , TUESDAY ,
  WEDNESDAY , THURSDAY , FRIDAY , SATURDAY
}
 Weekday values. More...
 

Functions

void clock_init_prev_dst (void)
 Load the DST period before the stored one.
 
void clock_copy_time_string (char *buffer, uint8_t size)
 Copies a time string into the buffer, formatted according to the user's time display preferences (such as 12h/24h time).
 
bool clock_is_24h_style (void)
 Gets the user's 12/24h clock style preference.
 
bool clock_is_timezone_set (void)
 Checks if timezone is currently set, otherwise gmtime == localtime.
 
pbl_time32_t clock_to_timestamp_time32 (WeekDay day, int hour, int minute)
 Converts a (day, hour, minute) specification to a UTC timestamp occurring in the future.
 
time_t clock_to_timestamp (WeekDay day, int hour, int minute)
 clock_to_timestamp_time32() with a full-width time_t, for the firmware.
 

Detailed Description

Functions, data structures and other things related to wall clock time.

This module contains utilities to get the current time and create strings with formatted dates and times.

Macro Definition Documentation

◆ TIME_STRING_BUFFER_SIZE

#define TIME_STRING_BUFFER_SIZE   26

Size of the buffers passed to time_t_to_string().

◆ TIMEZONE_NAME_LENGTH

#define TIMEZONE_NAME_LENGTH   32

The maximum length for a timezone full name (e.g.

America/Chicago)

Enumeration Type Documentation

◆ WeekDay

enum WeekDay

Weekday values.

Enumerator
TODAY 

Today.

SUNDAY 

Sunday.

MONDAY 

Monday.

TUESDAY 

Tuesday.

WEDNESDAY 

Wednesday.

THURSDAY 

Thursday.

FRIDAY 

Friday.

SATURDAY 

Saturday.

Function Documentation

◆ clock_copy_time_string()

void clock_copy_time_string ( char *  buffer,
uint8_t  size 
)

Copies a time string into the buffer, formatted according to the user's time display preferences (such as 12h/24h time).

Example results: "7:30" or "15:00".

Note
AM/PM are also outputted with the time if the user's preference is 12h time.
Parameters
[out]bufferA pointer to the buffer to copy the time string into
sizeThe maximum size of buffer

◆ clock_init_prev_dst()

void clock_init_prev_dst ( void  )

Load the DST period before the stored one.

Needs the timezone database.

◆ clock_is_24h_style()

bool clock_is_24h_style ( void  )

Gets the user's 12/24h clock style preference.

Returns
true if the user prefers 24h-style time display or false if the user prefers 12h-style time display.

◆ clock_is_timezone_set()

bool clock_is_timezone_set ( void  )

Checks if timezone is currently set, otherwise gmtime == localtime.

Returns
true if timezone has been set, false otherwise

◆ clock_to_timestamp()

time_t clock_to_timestamp ( WeekDay  day,
int  hour,
int  minute 
)

clock_to_timestamp_time32() with a full-width time_t, for the firmware.

◆ clock_to_timestamp_time32()

pbl_time32_t clock_to_timestamp_time32 ( WeekDay  day,
int  hour,
int  minute 
)

Converts a (day, hour, minute) specification to a UTC timestamp occurring in the future.

Always returns a timestamp for the next occurring instance, example: specifying TODAY@14:30 when it is 14:40 will return a timestamp for tomorrow at 14:30, while specifying the current day of the week will return a timestamp for 7 days from now.

Parameters
dayWeekDay day of week including support for specifying TODAY
hourhour specified in 24-hour format [0-23]
minuteminute [0-59]
Returns
UTC timestamp of the next occurrence.