From 6ae59c37110f794c5b134faae84098a72a62fd0e Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Tue, 6 Jun 2023 14:35:44 -0300 Subject: [PATCH] move dependencies --- examples/device-dashboard/net.c | 8 ++------ examples/stm32/nucleo-f746zg-baremetal/syscalls.c | 10 ++++++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/device-dashboard/net.c b/examples/device-dashboard/net.c index 371bb6b1..cb5a27fd 100644 --- a/examples/device-dashboard/net.c +++ b/examples/device-dashboard/net.c @@ -73,12 +73,8 @@ static int event_next(int no, struct event *e) { } // This is for newlib and TLS (mbedTLS) -int _gettimeofday(struct timeval *tv, void *tz) { - uint64_t now = mg_millis() + s_boot_timestamp; - (void) tz; - tv->tv_sec = (time_t) (now / 1000); - tv->tv_usec = (unsigned long) ((now % 1000) * 1000); - return 0; +uint64_t mg_now(void) { + return mg_millis() + s_boot_timestamp; } // SNTP connection event handler. When we get a response from an SNTP server, diff --git a/examples/stm32/nucleo-f746zg-baremetal/syscalls.c b/examples/stm32/nucleo-f746zg-baremetal/syscalls.c index ac27f093..6fef1007 100644 --- a/examples/stm32/nucleo-f746zg-baremetal/syscalls.c +++ b/examples/stm32/nucleo-f746zg-baremetal/syscalls.c @@ -86,3 +86,13 @@ int mkdir(const char *path, mode_t mode) { } void _init(void) {} + +extern uint64_t mg_now(void); + +int _gettimeofday(struct timeval *tv, void *tz) { + uint64_t now = mg_now(); + (void) tz; + tv->tv_sec = (time_t) (now / 1000); + tv->tv_usec = (unsigned long) ((now % 1000) * 1000); + return 0; +}