diff options
Diffstat (limited to 'unix/unix_mphal.c')
-rw-r--r-- | unix/unix_mphal.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/unix/unix_mphal.c b/unix/unix_mphal.c index 11cd03344d..0974b6ad21 100644 --- a/unix/unix_mphal.c +++ b/unix/unix_mphal.c @@ -27,6 +27,7 @@ #include <unistd.h> #include <stdlib.h> #include <string.h> +#include <sys/time.h> #include "py/mpstate.h" #include MICROPY_HAL_H @@ -117,3 +118,9 @@ void mp_hal_stdout_tx_strn_cooked(const char *str, mp_uint_t len) { void mp_hal_stdout_tx_str(const char *str) { mp_hal_stdout_tx_strn(str, strlen(str)); } + +uint32_t HAL_GetTick(void) { + struct timeval tv; + gettimeofday(&tv, NULL); + return tv.tv_sec * 1000 + tv.tv_usec / 1000; +} |