Mbed TLS v3.5.0
platform_time.h
Go to the documentation of this file.
1
6/*
7 * Copyright The Mbed TLS Contributors
8 * SPDX-License-Identifier: Apache-2.0
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); you may
11 * not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 */
22#ifndef MBEDTLS_PLATFORM_TIME_H
23#define MBEDTLS_PLATFORM_TIME_H
24
25#include "mbedtls/build_info.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/*
32 * The time_t datatype
33 */
34#if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO)
35typedef MBEDTLS_PLATFORM_TIME_TYPE_MACRO mbedtls_time_t;
36#else
37/* For time_t */
38#include <time.h>
39typedef time_t mbedtls_time_t;
40#endif /* MBEDTLS_PLATFORM_TIME_TYPE_MACRO */
41
42#if defined(MBEDTLS_PLATFORM_MS_TIME_TYPE_MACRO)
43typedef MBEDTLS_PLATFORM_MS_TIME_TYPE_MACRO mbedtls_ms_time_t;
44#else
45#include <stdint.h>
46#include <inttypes.h>
47typedef int64_t mbedtls_ms_time_t;
48#endif /* MBEDTLS_PLATFORM_MS_TIME_TYPE_MACRO */
49
64
65/*
66 * The function pointers for time
67 */
68#if defined(MBEDTLS_PLATFORM_TIME_ALT)
70
78int mbedtls_platform_set_time(mbedtls_time_t (*time_func)(mbedtls_time_t *time));
79#else
80#if defined(MBEDTLS_PLATFORM_TIME_MACRO)
81#define mbedtls_time MBEDTLS_PLATFORM_TIME_MACRO
82#else
83#define mbedtls_time time
84#endif /* MBEDTLS_PLATFORM_TIME_MACRO */
85#endif /* MBEDTLS_PLATFORM_TIME_ALT */
86
87#ifdef __cplusplus
88}
89#endif
90
91#endif /* platform_time.h */
Build-time configuration info.
int64_t mbedtls_ms_time_t
Definition: platform_time.h:47
mbedtls_ms_time_t mbedtls_ms_time(void)
Get time in milliseconds.
#define mbedtls_time
Definition: platform_time.h:83
time_t mbedtls_time_t
Definition: platform_time.h:39