From b58095821623a3f39de70e26d2d9f1fef173064d Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky <pfalcon@users.sourceforge.net> Date: Sat, 21 May 2016 02:15:17 +0300 Subject: [PATCH] unix/unix_mphal: Implement mp_hal_ticks_us(). Similar to existing mp_hal_ticks_ms(). --- unix/unix_mphal.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/unix/unix_mphal.c b/unix/unix_mphal.c index df3797627..6c6666236 100644 --- a/unix/unix_mphal.c +++ b/unix/unix_mphal.c @@ -191,3 +191,9 @@ mp_uint_t mp_hal_ticks_ms(void) { gettimeofday(&tv, NULL); return tv.tv_sec * 1000 + tv.tv_usec / 1000; } + +mp_uint_t mp_hal_ticks_us(void) { + struct timeval tv; + gettimeofday(&tv, NULL); + return tv.tv_sec * 1000000 + tv.tv_usec; +} -- GitLab