From 7e02c7dd2b97e059ee12c65667db4ca3bbec9249 Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Thu, 24 Oct 2013 16:34:54 +0200 Subject: [PATCH] add time delta to hwtimer --- cpu/native/hwtimer_cpu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cpu/native/hwtimer_cpu.c b/cpu/native/hwtimer_cpu.c index c9419522a8..62767deac4 100644 --- a/cpu/native/hwtimer_cpu.c +++ b/cpu/native/hwtimer_cpu.c @@ -45,6 +45,7 @@ #define HWTIMERMINOFFSET 100000 static unsigned long native_hwtimer_now; +static unsigned long time_null; static int native_hwtimer_irq[ARCH_MAXTIMERS]; static struct itimerval native_hwtimer[ARCH_MAXTIMERS]; @@ -240,7 +241,7 @@ unsigned long hwtimer_arch_now(void) #endif _native_in_syscall = 0; - native_hwtimer_now = ts2ticks(&t); + native_hwtimer_now = ts2ticks(&t) - time_null; DEBUG("hwtimer_arch_now(): it is now %lu s %lu ns\n", (unsigned long)t.tv_sec, (unsigned long)t.tv_nsec); @@ -263,6 +264,10 @@ void hwtimer_arch_init(void (*handler)(int), uint32_t fcpu) native_hwtimer[i].it_interval.tv_usec = 0; } + /* init time delta */ + time_null = 0; + time_null = hwtimer_arch_now(); + hwtimer_arch_enable_interrupt(); return; }