summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-05-21 02:15:17 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-05-21 02:16:35 +0300
commitb58095821623a3f39de70e26d2d9f1fef173064d (patch)
treed52af9351fe51bcdb151c57d3817b6473198cdd6
parent5a2a4e9452ef5325b111879e10d636fd0954e289 (diff)
downloadmicropython-b58095821623a3f39de70e26d2d9f1fef173064d.tar.gz
micropython-b58095821623a3f39de70e26d2d9f1fef173064d.zip
unix/unix_mphal: Implement mp_hal_ticks_us().
Similar to existing mp_hal_ticks_ms().
-rw-r--r--unix/unix_mphal.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/unix/unix_mphal.c b/unix/unix_mphal.c
index df37976272..6c66662362 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;
+}