PatchworkOS
Loading...
Searching...
No Matches
time_utils.c File Reference
#include "time_utils.h"

Go to the source code of this file.

Functions

void _time_zone_init (void)
 
_time_zone_t_time_zone (void)
 
bool _time_is_leap_year (int32_t year)
 
int32_t _time_days_in_month (int32_t month, int32_t year)
 
void _time_normalize (struct tm *timePtr)
 
void _time_day_of_week (struct tm *timePtr)
 
void _time_day_of_year (struct tm *timePtr)
 

Variables

_time_zone_t timeZone
 
static const int32_t daysInMonth [] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
 
static const int32_t cumulativeDays [] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}
 
static const int32_t cumulativeDaysLeap [] = {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}
 

Function Documentation

◆ _time_day_of_week()

void _time_day_of_week ( struct tm timePtr)

Definition at line 105 of file time_utils.c.

References tm::tm_mday, tm::tm_mon, tm::tm_wday, tm::tm_year, and y.

Referenced by mktime().

◆ _time_day_of_year()

void _time_day_of_year ( struct tm timePtr)

◆ _time_days_in_month()

int32_t _time_days_in_month ( int32_t  month,
int32_t  year 
)

Definition at line 29 of file time_utils.c.

References _time_is_leap_year(), and daysInMonth.

Referenced by _time_normalize(), and localtime_r().

◆ _time_is_leap_year()

bool _time_is_leap_year ( int32_t  year)

Definition at line 24 of file time_utils.c.

Referenced by _time_day_of_year(), _time_days_in_month(), localtime_r(), and mktime().

◆ _time_normalize()

void _time_normalize ( struct tm timePtr)

Definition at line 38 of file time_utils.c.

References _time_days_in_month(), tm::tm_hour, tm::tm_mday, tm::tm_min, tm::tm_mon, tm::tm_sec, and tm::tm_year.

Referenced by mktime().

◆ _time_zone()

_time_zone_t * _time_zone ( void  )

Definition at line 13 of file time_utils.c.

References timeZone.

Referenced by localtime_r().

◆ _time_zone_init()

void _time_zone_init ( void  )

Definition at line 5 of file time_utils.c.

References _time_zone_t::secondsOffset, and timeZone.

Referenced by _std_init().

Variable Documentation

◆ cumulativeDays

const int32_t cumulativeDays[] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}
static

Definition at line 21 of file time_utils.c.

Referenced by _time_day_of_year().

◆ cumulativeDaysLeap

const int32_t cumulativeDaysLeap[] = {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}
static

Definition at line 22 of file time_utils.c.

Referenced by _time_day_of_year().

◆ daysInMonth

const int32_t daysInMonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
static

Definition at line 20 of file time_utils.c.

Referenced by _time_days_in_month().

◆ timeZone

_time_zone_t timeZone

Definition at line 3 of file time_utils.c.

Referenced by _time_zone(), _time_zone_init(), and localtime_r().