Jerry Yu | 9a12df0 | 2023-03-03 12:55:16 +0800 | [diff] [blame^] | 1 | /* BEGIN_HEADER */ |
| 2 | |
| 3 | /* This test module exercises the platform_* module. Since, depending on the |
| 4 | * underlying operating system, the time routines are not always reliable, |
| 5 | * this suite only performs very basic sanity checks of the timing API. |
| 6 | */ |
| 7 | |
| 8 | #include <limits.h> |
| 9 | |
| 10 | #if defined(MBEDTLS_HAVE_TIME) |
| 11 | #include "mbedtls/platform_time.h" |
| 12 | #endif |
| 13 | |
| 14 | /* END_HEADER */ |
| 15 | |
| 16 | /* BEGIN_DEPENDENCIES |
| 17 | * END_DEPENDENCIES |
| 18 | */ |
| 19 | |
| 20 | /* BEGIN_CASE depends_on:MBEDTLS_HAVE_TIME */ |
| 21 | void time_get_milliseconds() |
| 22 | { |
| 23 | mbedtls_ms_time_t current = mbedtls_ms_time(); |
| 24 | (void) current; |
| 25 | /* This goto is added to avoid warnings from the generated code. */ |
| 26 | goto exit; |
| 27 | } |
| 28 | /* END_CASE */ |
| 29 | |
| 30 | /* BEGIN_CASE depends_on:MBEDTLS_HAVE_TIME */ |
| 31 | void time_get_seconds() |
| 32 | { |
| 33 | mbedtls_time_t current = mbedtls_time(NULL); |
| 34 | (void) current; |
| 35 | /* This goto is added to avoid warnings from the generated code. */ |
| 36 | goto exit; |
| 37 | } |
| 38 | /* END_CASE */ |