PebbleOS v4.47.0-512-g5285d4236
Loading...
Searching...
No Matches
time.h File Reference
#include <stdint.h>
#include <time.h>

Data Structures

struct  pbl_tm
 structure containing broken-down time for expressing calendar time (ie. More...
 

Macros

#define PBL_TZ_LEN   6
 Size of tm_zone in struct pbl_tm, including the terminating NUL.
 
#define PBL_TM_YEAR_ORIGIN   1900
 Year that tm_year in struct pbl_tm counts from.
 
#define PBL_EPOCH_YEAR   1970
 Year of the Unix epoch.
 
#define PBL_EPOCH_WDAY   4
 Day of the week of the Unix epoch (Thursday), as an enum pbl_weekday value.
 

Typedefs

typedef int32_t pbl_time32_t
 Seconds since the epoch, as a 32-bit time_t holds them.
 

Enumerations

enum  pbl_weekday {
  PBL_SUNDAY = 0 , PBL_MONDAY , PBL_TUESDAY , PBL_WEDNESDAY ,
  PBL_THURSDAY , PBL_FRIDAY , PBL_SATURDAY
}
 Day of the week, numbered like tm_wday. More...
 

Functions

static bool pbl_time_is_weekday (enum pbl_weekday day)
 Check whether a day is a working day (Monday to Friday).
 
static bool pbl_time_is_weekend (enum pbl_weekday day)
 Check whether a day is on the weekend (Saturday or Sunday).
 
bool pbl_time_is_leap_year (int year)
 Check whether a Gregorian year is a leap year.
 
int pbl_time_days_in_month (int month, bool is_leap_year)
 Get the number of days in a month.
 
void pbl_time_split_seconds (uint32_t seconds, uint32_t *days, uint32_t *hours, uint32_t *minutes, uint32_t *secs)
 Split a duration into days, hours, minutes and seconds.
 
int pbl_time_display_hour (int hour, bool is_24h)
 Convert an hour of the day to the hour shown on a clock.
 
int pbl_time_minute_of_day_adjust (int minute, int delta)
 Add a delta to a minute of the day, wrapping around midnight.
 
void pbl_time_breakdown (time_t t, struct pbl_tm *tm)
 Fill the calendar fields of a struct pbl_tm from seconds since the epoch.
 
struct pbl_tm * pbl_gmtime_r (const time_t *timep, struct pbl_tm *result)
 Convert seconds since the epoch to broken-down UTC time.
 
time_t pbl_mktime (struct pbl_tm *tb)
 Convert broken-down time to seconds since the epoch.
 
static pbl_time32_t pbl_time_to_time32 (time_t t)
 Narrow a time to 32 bits.
 
time_t pbl_time_from_time32 (pbl_time32_t t, time_t reference)
 Widen a 32-bit time.