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 26 extern "C" { 27 #endif // __cplusplus 28 29 typedef struct { 30 BslSalGetSysTime pfGetSysTime; 31 BslSalDateToStrConvert pfDateToStrConvert; 32 BslSalSysTimeGet pfSysTimeGet; 33 BslSalUtcTimeToDateConvert pfUtcTimeToDateConvert; 34 BslSalSleep pfSleep; 35 BslSalTick pfTick; 36 BslSalTicksPerSec pfTicksPerSec; 37 } BSL_SAL_TimeCallback; 38 39 int32_t SAL_TimeCallback_Ctrl(BSL_SAL_CB_FUNC_TYPE type, void *funcCb); 40 41 #ifdef HITLS_BSL_SAL_LINUX 42 int64_t TIME_GetSysTime(void); 43 uint32_t TIME_DateToStrConvert(const BSL_TIME *dateTime, char *timeStr, size_t len); 44 uint32_t TIME_SysTimeGet(BSL_TIME *sysTime); 45 uint32_t TIME_UtcTimeToDateConvert(int64_t utcTime, BSL_TIME *sysTime); 46 void SAL_Sleep(uint32_t time); 47 long SAL_Tick(void); 48 long SAL_TicksPerSec(void); 49 #endif 50 51 #ifdef __cplusplus 52 } 53 #endif // __cplusplus 54 55 #endif // HITLS_BSL_SAL_TIME 56 #endif // SAL_TIMEIMPL_H 57 58