Mbed OS Reference
Loading...
Searching...
No Matches
platform_time.h
Go to the documentation of this file.
1/**
2 * \file platform_time.h
3 *
4 * \brief mbed TLS Platform time abstraction
5 */
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#if !defined(MBEDTLS_CONFIG_FILE)
26#include "mbedtls/config.h"
27#else
28#include MBEDTLS_CONFIG_FILE
29#endif
30
31/**
32 * \ingroup mbedtls_platform_module
33 * \{
34 */
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40/**
41 * \name SECTION: Module settings
42 *
43 * The configuration options you can set for this module are in this section.
44 * Either change them in config.h or define them on the compiler command line.
45 * \{
46 */
47
48/*
49 * The time_t datatype
50 */
51#if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO)
52typedef MBEDTLS_PLATFORM_TIME_TYPE_MACRO mbedtls_time_t;
53#else
54/* For time_t */
55#include <time.h>
56typedef time_t mbedtls_time_t;
57#endif /* MBEDTLS_PLATFORM_TIME_TYPE_MACRO */
58
59/*
60 * The function pointers for time
61 */
62#if defined(MBEDTLS_PLATFORM_TIME_ALT)
63extern mbedtls_time_t (*mbedtls_time)( mbedtls_time_t* time );
64
65/**
66 * \brief Set your own time function pointer
67 *
68 * \param time_func the time function implementation
69 *
70 * \return 0
71 */
72int mbedtls_platform_set_time( mbedtls_time_t (*time_func)( mbedtls_time_t* time ) );
73#else
74#if defined(MBEDTLS_PLATFORM_TIME_MACRO)
75#define mbedtls_time MBEDTLS_PLATFORM_TIME_MACRO
76#else
77#define mbedtls_time time
78#endif /* MBEDTLS_PLATFORM_TIME_MACRO */
79#endif /* MBEDTLS_PLATFORM_TIME_ALT */
80
81/// \}
82
83#ifdef __cplusplus
84}
85#endif
86
87/// \}
88
89#endif /* platform_time.h */
Configuration options (set of defines)