API参考
载入中...
搜索中...
未找到
sal_timeimpl.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_TIMEIMPL_H
17#define SAL_TIMEIMPL_H
18
19#include "hitls_build.h"
20#ifdef HITLS_BSL_SAL_TIME
21
22#include <stdint.h>
23#include "bsl_sal.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif // __cplusplus
28
29typedef struct {
30 BslGetUtcTime pfGetUtcTime;
31 BslGetBslTime pfGetBslTime;
32 BslUtcTimeToBslTime pfUtcTimeToBslTime;
33 BslSleep pfSleep;
34 BslTick pfTick;
35 BslTicksPerSec pfTicksPerSec;
36 BslGetTimeInNS pfBslGetTimeInNS;
37} BSL_SAL_TimeCallback;
38
46int32_t SAL_TimeCallBack_Ctrl(BSL_SAL_CB_FUNC_TYPE type, void *funcCb);
47
48#if defined(HITLS_BSL_SAL_LINUX) || defined(HITLS_BSL_SAL_DARWIN)
49int64_t SAL_TIME_GetSysTime(void);
50uint32_t TIME_DateToStrConvert(const BSL_TIME *dateTime, char *timeStr, size_t len);
51int32_t SAL_TIME_SysTimeGet(BSL_TIME *sysTime);
52int32_t SAL_TIME_UtcTimeToDateConvert(int64_t utcTime, BSL_TIME *sysTime);
53long SAL_TIME_Tick(void);
54long SAL_TIME_TicksPerSec(void);
55uint64_t SAL_TIME_GetNSec(void);
56
57void SAL_TIME_Sleep(uint32_t time);
58#endif
59#ifdef __cplusplus
60}
61#endif // __cplusplus
62
63#endif // HITLS_BSL_SAL_TIME
64#endif // SAL_TIMEIMPL_H
65
int32_t(* BslUtcTimeToBslTime)(int64_t utcTime, BSL_TIME *sysTime)
Convert the utc time to BSL_TIME.
定义 bsl_sal.h:1509
long(* BslTicksPerSec)(void)
Obtain the number of system ticks per second.
定义 bsl_sal.h:1545
long(* BslTick)(void)
Obtain the number of ticks that the system has experienced since startup.
定义 bsl_sal.h:1533
uint64_t(* BslGetTimeInNS)(void)
Obtain the system time in nanoseconds.
定义 bsl_sal.h:1557
void(* BslSleep)(uint32_t time)
Sets the program to sleep for a specified time, in seconds.
定义 bsl_sal.h:1521
BslUnixTime(* BslGetUtcTime)(void)
Obtains the current UTC time
定义 bsl_sal.h:1482
int32_t(* BslGetBslTime)(BSL_TIME *bslTime)
Obtains the current system time. The time type is BSL_TIME.
定义 bsl_sal.h:1495
Basic time data structure definition.
定义 bsl_sal.h:583