diff options
Diffstat (limited to 'arch/um/os-Linux/time.c')
-rw-r--r-- | arch/um/os-Linux/time.c | 22 |
1 files changed, 19 insertions, 3 deletions
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) | |||
39 | return 0; | 39 | return 0; |
40 | } | 40 | } |
41 | 41 | ||
42 | unsigned long long disable_timer(void) | 42 | /** |
43 | * timeval_to_ns - Convert timeval to nanoseconds | ||
44 | * @ts: pointer to the timeval variable to be converted | ||
45 | * | ||
46 | * Returns the scalar nanosecond representation of the timeval | ||
47 | * parameter. | ||
48 | * | ||
49 | * Ripped from linux/time.h because it's a kernel header, and thus | ||
50 | * unusable from here. | ||
51 | */ | ||
52 | static inline long long timeval_to_ns(const struct timeval *tv) | ||
53 | { | ||
54 | return ((long long) tv->tv_sec * UM_NSEC_PER_SEC) + | ||
55 | tv->tv_usec * UM_NSEC_PER_USEC; | ||
56 | } | ||
57 | |||
58 | long long disable_timer(void) | ||
43 | { | 59 | { |
44 | struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } }); | 60 | struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } }); |
45 | 61 | ||
@@ -47,10 +63,10 @@ unsigned long long disable_timer(void) | |||
47 | printk(UM_KERN_ERR "disable_timer - setitimer failed, " | 63 | printk(UM_KERN_ERR "disable_timer - setitimer failed, " |
48 | "errno = %d\n", errno); | 64 | "errno = %d\n", errno); |
49 | 65 | ||
50 | return tv_to_nsec(&time.it_value); | 66 | return timeval_to_ns(&time.it_value); |
51 | } | 67 | } |
52 | 68 | ||
53 | unsigned long long os_nsecs(void) | 69 | long long os_nsecs(void) |
54 | { | 70 | { |
55 | struct timeval tv; | 71 | struct timeval tv; |
56 | 72 | ||