[riot-notifications] [RIOT-OS/RIOT] arduino-due problem with time functions? (#14133)
notifications at github.com
Mon May 25 20:22:16 CEST 2020
When you have to use `float` or `double`, then go for it. But here it is not needed. In fact, every API in xtimer works on integer types anyway. So just keep the time values in `uint32_t` or (if you need a higher range) in `uint64_t` and keep the resolution at µs. If you want to print the time in ms with a decimal place, you could do something like this:
static inline void print_us_as_ms(uint32_t time_us)
uint32_t time_ms = time_us / 1000;
uint32_t remainder = time_us % 1000;
printf("%" PRIu32 ".%03" PRIu32 " ms", time_ms, remainder);
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications