aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/time.c
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-10-16 01:27:28 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 09:43:08 -0700
commit1a80521990a0e30e61a92994a009adc52161b070 (patch)
tree3cf900adf9383ff68fd66cd74cfaf0e0ce483845 /arch/um/os-Linux/time.c
parentuml: eliminate SIGALRM (diff)
downloadlinux-dev-1a80521990a0e30e61a92994a009adc52161b070.tar.xz
linux-dev-1a80521990a0e30e61a92994a009adc52161b070.zip
uml: use *SEC_PER_*SEC constants
There are various uses of powers of 1000, plus the odd BILLION constant in the time code. However, there are perfectly good definitions of *SEC_PER_*SEC in linux/time.h which can be used instaed. These are replaced directly in kernel code. Userspace code imports those constants as UM_*SEC_PER_*SEC and uses these. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> 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/time.c')
-rw-r--r--arch/um/os-Linux/time.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index 574b134f0502..e34e1effe0f5 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -14,7 +14,7 @@
int set_interval(void)
{
- int usec = 1000000/UM_HZ;
+ int usec = UM_USEC_PER_SEC / UM_HZ;
struct itimerval interval = ((struct itimerval) { { 0, usec },
{ 0, usec } });
@@ -26,11 +26,11 @@ int set_interval(void)
int timer_one_shot(int ticks)
{
- unsigned long usec = ticks * 1000000 / UM_HZ;
- unsigned long sec = usec / 1000000;
+ unsigned long usec = ticks * UM_USEC_PER_SEC / UM_HZ;
+ unsigned long sec = usec / UM_USEC_PER_SEC;
struct itimerval interval;
- usec %= 1000000;
+ usec %= UM_USEC_PER_SEC;
interval = ((struct itimerval) { { 0, 0 }, { sec, usec } });
if (setitimer(ITIMER_VIRTUAL, &interval, NULL) == -1)
@@ -78,8 +78,8 @@ extern void alarm_handler(int sig, struct sigcontext *sc);
void idle_sleep(unsigned long long nsecs)
{
- struct timespec ts = { .tv_sec = nsecs / BILLION,
- .tv_nsec = nsecs % BILLION };
+ struct timespec ts = { .tv_sec = nsecs / UM_NSEC_PER_SEC,
+ .tv_nsec = nsecs % UM_NSEC_PER_SEC };
if (nanosleep(&ts, &ts) == 0)
alarm_handler(SIGVTALRM, NULL);