2023-03-03 12:55:16 +08:00
|
|
|
/* BEGIN_HEADER */
|
|
|
|
|
|
|
|
/* This test module exercises the platform_* module. Since, depending on the
|
|
|
|
* underlying operating system, the time routines are not always reliable,
|
|
|
|
* this suite only performs very basic sanity checks of the timing API.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <limits.h>
|
|
|
|
|
|
|
|
#if defined(MBEDTLS_HAVE_TIME)
|
|
|
|
#include "mbedtls/platform_time.h"
|
2023-03-13 14:28:06 +08:00
|
|
|
|
2023-03-03 12:55:16 +08:00
|
|
|
/* END_HEADER */
|
|
|
|
|
2023-03-13 14:28:06 +08:00
|
|
|
/* BEGIN_DEPENDENCIES */
|
|
|
|
|
|
|
|
/* END_DEPENDENCIES */
|
|
|
|
|
|
|
|
|
2023-03-03 12:55:16 +08:00
|
|
|
|
|
|
|
/* BEGIN_CASE depends_on:MBEDTLS_HAVE_TIME */
|
|
|
|
void time_get_milliseconds()
|
|
|
|
{
|
2023-03-14 17:33:42 +08:00
|
|
|
mbedtls_ms_time_t current = mbedtls_ms_time();
|
2023-03-03 12:55:16 +08:00
|
|
|
(void) current;
|
|
|
|
/* This goto is added to avoid warnings from the generated code. */
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
/* END_CASE */
|
|
|
|
|
|
|
|
/* BEGIN_CASE depends_on:MBEDTLS_HAVE_TIME */
|
|
|
|
void time_get_seconds()
|
|
|
|
{
|
2023-03-14 17:33:42 +08:00
|
|
|
mbedtls_time_t current = mbedtls_time(NULL);
|
2023-03-03 12:55:16 +08:00
|
|
|
(void) current;
|
|
|
|
/* This goto is added to avoid warnings from the generated code. */
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
/* END_CASE */
|