API参考
载入中...
搜索中...
未找到
sal_time.h
1/*
2 * This file is part of the openHiTLS project.
3 *
4 * openHiTLS is licensed under the Mulan PSL v2.
5 * You can use this software according to the terms and conditions of the Mulan PSL v2.
6 * You may obtain a copy of Mulan PSL v2 at:
7 *
8 * http://license.coscl.org.cn/MulanPSL2
9 *
10 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13 * See the Mulan PSL v2 for more details.
14 */
15
16#ifndef SAL_TIME_H
17#define SAL_TIME_H
18
19#include "hitls_build.h"
20#ifdef HITLS_BSL_SAL_TIME
21
22#include <stddef.h>
23#include <stdint.h>
24#include <stdbool.h>
25#include "bsl_sal.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#define BSL_TIME_YEAR_START 1900U
32#define BSL_TIME_SYSTEM_EPOCH_YEAR 1970U
33#define BSL_TIME_DAY_PER_NONLEAP_YEAR 365U
34
35#define BSL_TIME_BIG_MONTH_DAY 31U
36#define BSL_TIME_SMALL_MONTH_DAY 30U
37#define BSL_TIME_LEAP_FEBRUARY_DAY 29U
38#define BSL_TIME_NOLEAP_FEBRUARY_DAY 28U
39
40#define BSL_MONTH_JAN 1U /* January */
41#define BSL_MONTH_FEB 2U /* February */
42#define BSL_MONTH_MAR 3U /* March */
43#define BSL_MONTH_APR 4U /* April */
44#define BSL_MONTH_MAY 5U /* May */
45#define BSL_MONTH_JUN 6U /* June */
46#define BSL_MONTH_JUL 7U /* July */
47#define BSL_MONTH_AUG 8U /* August */
48#define BSL_MONTH_SEM 9U /* September */
49#define BSL_MONTH_OCT 10U /* October */
50#define BSL_MONTH_NOV 11U /* November */
51#define BSL_MONTH_DEC 12U /* December */
52
53#define BSL_TIME_TICKS_PER_SECOND_DEFAULT 100U
54#define BSL_SECOND_TRANSFER_RATIO 1000U /* conversion ratio of microseconds -> milliseconds -> seconds */
55
56#define BSL_UTCTIME_MAX 2005949145599L /* UTC time corresponding to December 31, 65535 23:59:59 */
57
58#define BSL_TIME_SECS_PER_DAY 86400L /* seconds per day */
59
60bool BSL_IsLeapYear(uint32_t year);
61
69int32_t BSL_DateTimeAddUs(BSL_TIME *dateR, const BSL_TIME *dateA, uint32_t us);
70
80int32_t BSL_DateTimeAddDaySecond(BSL_TIME *dateR, const BSL_TIME *dateA, int32_t offsetDay, int64_t offsetSecond);
81
88bool BSL_DateTimeCheck(const BSL_TIME *dateTime);
89
90void BSL_SysTimeFuncUnReg(void);
91
92#ifdef __cplusplus
93}
94#endif
95
96#endif /* HITLS_BSL_SAL_TIME */
97
98#endif // SAL_TIME_H
Basic time data structure definition.
定义 bsl_sal.h:583