Denislam Valeev / Mbed OS Nucleo_rtos_basic
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers platform_time.h Source File

platform_time.h

Go to the documentation of this file.
00001 /**
00002  * \file platform_time.h
00003  *
00004  * \brief mbed TLS Platform time abstraction
00005  */
00006 /*
00007  *  Copyright (C) 2006-2016, ARM Limited, All Rights Reserved
00008  *  SPDX-License-Identifier: Apache-2.0
00009  *
00010  *  Licensed under the Apache License, Version 2.0 (the "License"); you may
00011  *  not use this file except in compliance with the License.
00012  *  You may obtain a copy of the License at
00013  *
00014  *  http://www.apache.org/licenses/LICENSE-2.0
00015  *
00016  *  Unless required by applicable law or agreed to in writing, software
00017  *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00018  *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00019  *  See the License for the specific language governing permissions and
00020  *  limitations under the License.
00021  *
00022  *  This file is part of mbed TLS (https://tls.mbed.org)
00023  */
00024 #ifndef MBEDTLS_PLATFORM_TIME_H
00025 #define MBEDTLS_PLATFORM_TIME_H
00026 
00027 #if !defined(MBEDTLS_CONFIG_FILE)
00028 #include "config.h"
00029 #else
00030 #include MBEDTLS_CONFIG_FILE
00031 #endif
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 /**
00038  * \name SECTION: Module settings
00039  *
00040  * The configuration options you can set for this module are in this section.
00041  * Either change them in config.h or define them on the compiler command line.
00042  * \{
00043  */
00044 
00045 /*
00046  * The time_t datatype
00047  */
00048 #if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO)
00049 typedef MBEDTLS_PLATFORM_TIME_TYPE_MACRO mbedtls_time_t;
00050 #else
00051 /* For time_t */
00052 #include <time.h>
00053 typedef time_t mbedtls_time_t;
00054 #endif /* MBEDTLS_PLATFORM_TIME_TYPE_MACRO */
00055 
00056 /*
00057  * The function pointers for time
00058  */
00059 #if defined(MBEDTLS_PLATFORM_TIME_ALT)
00060 extern mbedtls_time_t (*mbedtls_time)( mbedtls_time_t* time );
00061 
00062 /**
00063  * \brief   Set your own time function pointer
00064  *
00065  * \param   time_func   the time function implementation
00066  *
00067  * \return              0
00068  */
00069 int mbedtls_platform_set_time( mbedtls_time_t (*time_func)( mbedtls_time_t* time ) );
00070 #else
00071 #if defined(MBEDTLS_PLATFORM_TIME_MACRO)
00072 #define mbedtls_time    MBEDTLS_PLATFORM_TIME_MACRO
00073 #else
00074 #define mbedtls_time   time
00075 #endif /* MBEDTLS_PLATFORM_TIME_MACRO */
00076 #endif /* MBEDTLS_PLATFORM_TIME_ALT */
00077 
00078 #ifdef __cplusplus
00079 }
00080 #endif
00081 
00082 #endif /* platform_time.h */