LexLeo 0.0.0-dev+f8e5087-dirty
Technical documentation
Loading...
Searching...
No Matches
logger_default_utc_timestamp.c File Reference

Private UTC timestamp conversion helpers for the logger_default adapter. More...

Include dependency graph for logger_default_utc_timestamp.c:

Go to the source code of this file.

Functions

static bool logger_default_is_leap_year (int32_t year)
 Return whether a Gregorian calendar year is leap.
 
static int32_t logger_default_days_in_year (int32_t year)
 Return the number of days in a Gregorian calendar year.
 
static int32_t logger_default_days_in_month (int32_t year, int32_t month)
 Return the number of days in a Gregorian calendar month.
 
bool logger_default_epoch_time_to_date (logger_default_utc_timestamp_t *out, const osal_time_t *time)
 Convert an epoch-time value to a decomposed UTC timestamp.
 

Detailed Description

This file implements private helpers used to convert epoch-time values into decomposed UTC+0 civil timestamps for logger_default log formatting.

Definition in file logger_default_utc_timestamp.c.

Function Documentation

◆ logger_default_days_in_month()

static int32_t logger_default_days_in_month ( int32_t  year,
int32_t  month 
)
static
Parameters
[in]yearGregorian calendar year.
[in]monthGregorian calendar month in the range [1, 12].
Returns
Number of days in the requested month for the requested year.

Definition at line 66 of file logger_default_utc_timestamp.c.

◆ logger_default_days_in_year()

static int32_t logger_default_days_in_year ( int32_t  year)
static
Parameters
[in]yearGregorian calendar year.
Returns
366 if year is leap, otherwise 365.

Definition at line 49 of file logger_default_utc_timestamp.c.

◆ logger_default_epoch_time_to_date()

bool logger_default_epoch_time_to_date ( logger_default_utc_timestamp_t out,
const osal_time_t time 
)

This helper interprets time->epoch_seconds as a UTC+0 Unix epoch-time value and converts it into calendar and clock fields stored in *out.

Parameters
[out]outReceives the converted UTC timestamp. Must not be NULL.
[in]timeEpoch-time value to convert. Must not be NULL.
Return values
trueConversion succeeded and *out was populated.
falseOne or more arguments are invalid.

Definition at line 102 of file logger_default_utc_timestamp.c.

◆ logger_default_is_leap_year()

static bool logger_default_is_leap_year ( int32_t  year)
static

A year is leap if it is divisible by 4, except century years that are not divisible by 400.

Parameters
[in]yearGregorian calendar year.
Return values
trueyear is a leap year.
falseyear is not a leap year.

Definition at line 35 of file logger_default_utc_timestamp.c.