mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-30 08:51:19 +01:00
sys/xtimer: rename _ms_to_sec -> _us_to_sec to reflect actual functionality
The function divides the argument by 1000000, (microsecond to seconds)
This commit is contained in:
parent
4cfb8140e4
commit
7f254c6d12
@ -155,16 +155,16 @@ void xtimer_set_wakeup64(xtimer_t *timer, uint64_t offset, kernel_pid_t pid)
|
||||
* This is to avoid using long integer division functions
|
||||
* the compiler otherwise links in.
|
||||
*/
|
||||
static inline uint64_t _ms_to_sec(uint64_t ms)
|
||||
static inline uint64_t _us_to_sec(uint64_t us)
|
||||
{
|
||||
return (unsigned long long)(ms * 0x431bde83) >> (0x12 + 32);
|
||||
return (unsigned long long)(us * 0x431bde83) >> (0x12 + 32);
|
||||
}
|
||||
|
||||
void xtimer_now_timex(timex_t *out)
|
||||
{
|
||||
uint64_t now = xtimer_now64();
|
||||
|
||||
out->seconds = _ms_to_sec(now);
|
||||
out->seconds = _us_to_sec(now);
|
||||
out->microseconds = now - (out->seconds * SEC_IN_USEC);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user