Skip to content

Commit 6cb7c82

Browse files
authored
Merge pull request #9792 from jepler/rp2350-ssllib
mbedtls: avoid function that only exists on rp2040
2 parents bf412b4 + e105915 commit 6cb7c82

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/mbedtls_config/mbedtls_port.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,13 @@
2727

2828
#if CIRCUITPY_SSL_MBEDTLS
2929

30+
#include "py/runtime.h"
3031
#include "mbedtls_config.h"
3132
#include "mbedtls/entropy_poll.h"
3233

33-
#include "hardware/rtc.h"
3434
#include "shared/timeutils/timeutils.h"
3535
#include "shared-bindings/os/__init__.h"
36-
37-
#include "hardware/rtc.h"
38-
#include "shared/timeutils/timeutils.h"
36+
#include "shared-bindings/time/__init__.h"
3937

4038
extern uint8_t rosc_random_u8(size_t cycles);
4139

@@ -46,9 +44,10 @@ int mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t
4644
}
4745

4846
time_t rp2_rtctime_seconds(time_t *timer) {
49-
datetime_t t;
50-
rtc_get_datetime(&t);
51-
return timeutils_seconds_since_epoch(t.year, t.month, t.day, t.hour, t.min, t.sec);
47+
mp_obj_t datetime = mp_load_attr(MP_STATE_VM(rtc_time_source), MP_QSTR_datetime);
48+
timeutils_struct_time_t tm;
49+
struct_time_to_tm(datetime, &tm);
50+
return timeutils_seconds_since_epoch(tm.tm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
5251
}
5352

5453
#endif

0 commit comments

Comments
 (0)