move dependencies

This commit is contained in:
Sergio R. Caprile 2023-06-06 14:35:44 -03:00
parent c8f5f85635
commit 6ae59c3711
2 changed files with 12 additions and 6 deletions

View File

@ -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,

View File

@ -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;
}