mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 22:13:52 +01:00
Merge pull request #1021 from Kijewski/vtimer_now-no-16bit-overflow
vtimer: fix integer overflow in vtimer_now() for MSP-430
This commit is contained in:
commit
dcf4c3a80e
@ -261,9 +261,10 @@ static int vtimer_set(vtimer_t *timer)
|
||||
void vtimer_now(timex_t *out)
|
||||
{
|
||||
uint32_t us = HWTIMER_TICKS_TO_US(hwtimer_now() - longterm_tick_start);
|
||||
uint32_t us_per_s = 1000ul * 1000ul;
|
||||
|
||||
out->seconds = seconds + us / (1000 * 1000);
|
||||
out->microseconds = us % (1000 * 1000);
|
||||
out->seconds = seconds + us / us_per_s;
|
||||
out->microseconds = us % us_per_s;
|
||||
}
|
||||
|
||||
void vtimer_gettimeofday(struct timeval *tp) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user