f806c5829b
* 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>
58 lines
1.4 KiB
C
58 lines
1.4 KiB
C
/**
|
|
* @file
|
|
* @brief This file contains the function prototypes for the days calculations
|
|
* @author Steve Karg <skarg@users.sourceforge.net>
|
|
* @date 1997
|
|
* @copyright SPDX-License-Identifier: CC-PDDC
|
|
*/
|
|
#ifndef DAYS_H
|
|
#define DAYS_H
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
/* BACnet Stack defines - first */
|
|
#include "bacnet/bacdef.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif /* __cplusplus */
|
|
|
|
BACNET_STACK_EXPORT
|
|
bool days_is_leap_year(uint16_t year);
|
|
BACNET_STACK_EXPORT
|
|
uint8_t days_per_month(uint16_t year, uint8_t month);
|
|
BACNET_STACK_EXPORT
|
|
uint32_t days_per_year(uint16_t year);
|
|
BACNET_STACK_EXPORT
|
|
uint16_t days_of_year(uint16_t year, uint8_t month, uint8_t day);
|
|
BACNET_STACK_EXPORT
|
|
uint16_t days_of_year_remaining(uint16_t year, uint8_t month, uint8_t day);
|
|
BACNET_STACK_EXPORT
|
|
void days_of_year_to_month_day(
|
|
uint32_t days, uint16_t year, uint8_t *pMonth, uint8_t *pDay);
|
|
BACNET_STACK_EXPORT
|
|
uint32_t days_apart(
|
|
uint16_t year1,
|
|
uint8_t month1,
|
|
uint8_t day1,
|
|
uint16_t year2,
|
|
uint8_t month2,
|
|
uint8_t day2);
|
|
BACNET_STACK_EXPORT
|
|
uint32_t days_since_epoch(
|
|
uint16_t epoch_year, uint16_t year, uint8_t month, uint8_t day);
|
|
BACNET_STACK_EXPORT
|
|
void days_since_epoch_to_date(
|
|
uint16_t epoch_year,
|
|
uint32_t days,
|
|
uint16_t *pYear,
|
|
uint8_t *pMonth,
|
|
uint8_t *pDay);
|
|
|
|
BACNET_STACK_EXPORT
|
|
bool days_date_is_valid(uint16_t year, uint8_t month, uint8_t day);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif /* __cplusplus */
|
|
#endif
|