diff options
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/include/os.h | 4 | ||||
-rw-r--r-- | arch/um/os-Linux/time.c | 22 |
2 files changed, 21 insertions, 5 deletions
diff --git a/arch/um/include/os.h b/arch/um/include/os.h index 91642e4137d7..a1b0804ee57b 100644 --- a/arch/um/include/os.h +++ b/arch/um/include/os.h @@ -254,9 +254,9 @@ extern void os_dump_core(void); extern void idle_sleep(unsigned long long nsecs); extern int set_interval(void); extern int timer_one_shot(int ticks); -extern unsigned long long disable_timer(void); +extern long long disable_timer(void); extern void uml_idle_timer(void); -extern unsigned long long os_nsecs(void); +extern long long os_nsecs(void); /* skas/mem.c */ extern long run_syscall_stub(struct mm_id * mm_idp, diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c index d2cb161ae2b3..574b134f0502 100644 --- a/arch/um/os-Linux/time.c +++ b/arch/um/os-Linux/time.c @@ -39,7 +39,23 @@ int timer_one_shot(int ticks) return 0; } -unsigned long long disable_timer(void) +/** + * timeval_to_ns - Convert timeval to nanoseconds + * @ts: pointer to the timeval variable to be converted + * + * Returns the scalar nanosecond representation of the timeval + * parameter. + * + * Ripped from linux/time.h because it's a kernel header, and thus + * unusable from here. + */ +static inline long long timeval_to_ns(const struct timeval *tv) +{ + return ((long long) tv->tv_sec * UM_NSEC_PER_SEC) + + tv->tv_usec * UM_NSEC_PER_USEC; +} + +long long disable_timer(void) { struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } }); @@ -47,10 +63,10 @@ unsigned long long disable_timer(void) printk(UM_KERN_ERR "disable_timer - setitimer failed, " "errno = %d\n", errno); - return tv_to_nsec(&time.it_value); + return timeval_to_ns(&time.it_value); } -unsigned long long os_nsecs(void) +long long os_nsecs(void) { struct timeval tv; |