mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
py/mphal.h: Introduce mp_hal_time_ns and implement on various ports.
This should return a 64-bit value being the number of nanoseconds since 1970/1/1. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -214,3 +214,8 @@ mp_uint_t mp_hal_ticks_us(void) {
|
||||
return tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint64_t mp_hal_time_ns(void) {
|
||||
time_t now = time(NULL);
|
||||
return (uint64_t)now * 1000000000ULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user