diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-10-16 12:27:27 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 20:43:08 +0400 |
commit | 5f734614fc6218db352d26571ab4d1604620199c (patch) | |
tree | ff1323d87862c0522ef83568543f46b46eac941a /arch/um/os-Linux | |
parent | b160fb6309dc907cbd8849e549d83badb86dd35b (diff) | |
download | linux-5f734614fc6218db352d26571ab4d1604620199c.tar.xz |
uml: time build fix
Put back an implementation of timeval_to_ns in arch/um/os-Linux/time.c.
tglx pointed out in his review of tickless support that there was a
perfectly good implementation of it in linux/time.h. The problem is that
this is userspace code which can't pull in kernel headers and there doesn't
seem to be a libc version.
So, I'm copying the version from linux/time.h rather than resurrecting my
version. This causes some declaration changes as it now returns a signed
value rather than an unsigned value.
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/os-Linux')
-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) 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; |