alif/mbedtls: Implement the mbedTLS time function.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2025-08-12 13:05:09 +10:00
parent 46b366d7b2
commit 326730d8b2

View File

@@ -24,15 +24,10 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "py/obj.h" #include "py/mphal.h"
#include "se_services.h" #include "se_services.h"
#include "mbedtls_config_port.h" #include "mbedtls_config_port.h"
#if defined(MBEDTLS_HAVE_TIME)
#include "shared/timeutils/timeutils.h"
#include "mbedtls/platform_time.h"
#endif
int mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t *olen) { int mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t *olen) {
uint32_t val = 0; uint32_t val = 0;
int n = 0; int n = 0;
@@ -52,14 +47,7 @@ int mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t
#if defined(MBEDTLS_HAVE_TIME) #if defined(MBEDTLS_HAVE_TIME)
time_t alif_mbedtls_time(time_t *timer) { time_t alif_mbedtls_time(time_t *timer) {
// TODO implement proper RTC time return mp_hal_time_get(NULL);
unsigned int year = 2025;
unsigned int month = 1;
unsigned int date = 1;
unsigned int hours = 12;
unsigned int minutes = 0;
unsigned int seconds = 0;
return timeutils_seconds_since_epoch(year, month, date, hours, minutes, seconds);
} }
#endif #endif