Run clang-format and enable CI check for it (#755)
* pre-commit: Update and enable clang-format check There is newer version from clang-format so use that. We do not yet want 18 as that is little bit too new. * Format some thing by hand which clang-format "breaks" Clang-format will format some things little bit off in some cases. Format some things by hand so we get cleaner end result. * Run clang-format with ``` pre-commit run --all-files clang-format ``` We have already in previously checked places where clang-format does not make good format and ignored those (hopefully most of the things). --------- Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
@@ -37,8 +37,9 @@ uint8_t days_per_month(uint16_t year, uint8_t month)
|
||||
{
|
||||
/* note: start with a zero in the first element to save us from a
|
||||
month - 1 calculation in the lookup */
|
||||
uint8_t month_days[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30,
|
||||
31 };
|
||||
uint8_t month_days[13] = {
|
||||
0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
|
||||
};
|
||||
|
||||
if ((month == 2) && days_is_leap_year(year)) {
|
||||
return (29);
|
||||
@@ -146,7 +147,8 @@ void days_of_year_to_month_day(
|
||||
* @param day1 - day of month (1-31)
|
||||
* @return number of days apart, or 0 if same dates
|
||||
*/
|
||||
uint32_t days_apart(uint16_t year1,
|
||||
uint32_t days_apart(
|
||||
uint16_t year1,
|
||||
uint8_t month1,
|
||||
uint8_t day1,
|
||||
uint16_t year2,
|
||||
@@ -197,8 +199,8 @@ uint32_t days_apart(uint16_t year1,
|
||||
* @param day - day of month (1-31)
|
||||
* @return number of days since epoch, or 0 if out of range
|
||||
*/
|
||||
uint32_t days_since_epoch(
|
||||
uint16_t epoch_year, uint16_t year, uint8_t month, uint8_t day)
|
||||
uint32_t
|
||||
days_since_epoch(uint16_t epoch_year, uint16_t year, uint8_t month, uint8_t day)
|
||||
{
|
||||
uint32_t days = 0; /* return value */
|
||||
uint16_t yy = 0; /* year */
|
||||
@@ -233,7 +235,8 @@ uint32_t days_since_epoch(
|
||||
* @param pDay - day of month (1-31)
|
||||
* @return nothing
|
||||
*/
|
||||
void days_since_epoch_to_date(uint16_t epoch_year,
|
||||
void days_since_epoch_to_date(
|
||||
uint16_t epoch_year,
|
||||
uint32_t days,
|
||||
uint16_t *pYear,
|
||||
uint8_t *pMonth,
|
||||
|
||||
Reference in New Issue
Block a user