blob: aadcc39c2896be40b257c5bd3dfb968336e68db5 [file] [log] [blame]
Jerry Yu9a12df02023-03-03 12:55:16 +08001/* 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"
Jerry Yuc5b48a62023-03-13 14:28:06 +080012
Jerry Yu9a12df02023-03-03 12:55:16 +080013/* END_HEADER */
14
Jerry Yuc5b48a62023-03-13 14:28:06 +080015/* BEGIN_DEPENDENCIES */
16
17/* END_DEPENDENCIES */
18
19
Jerry Yu9a12df02023-03-03 12:55:16 +080020
21/* BEGIN_CASE depends_on:MBEDTLS_HAVE_TIME */
22void time_get_milliseconds()
23{
Jerry Yue7ea8232023-03-14 17:33:42 +080024 mbedtls_ms_time_t current = mbedtls_ms_time();
Jerry Yu9a12df02023-03-03 12:55:16 +080025 (void) current;
26 /* This goto is added to avoid warnings from the generated code. */
27 goto exit;
28}
29/* END_CASE */
30
31/* BEGIN_CASE depends_on:MBEDTLS_HAVE_TIME */
32void time_get_seconds()
33{
Jerry Yue7ea8232023-03-14 17:33:42 +080034 mbedtls_time_t current = mbedtls_time(NULL);
Jerry Yu9a12df02023-03-03 12:55:16 +080035 (void) current;
36 /* This goto is added to avoid warnings from the generated code. */
37 goto exit;
38}
39/* END_CASE */