Rtos API example

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