diff options
Diffstat (limited to 'arch/um/kernel/time.c')
-rw-r--r-- | arch/um/kernel/time.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index b1f8b0752419..cd7349de8ca6 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include "asm/param.h" | 18 | #include "asm/param.h" |
19 | #include "asm/current.h" | 19 | #include "asm/current.h" |
20 | #include "kern_util.h" | 20 | #include "kern_util.h" |
21 | #include "user_util.h" | ||
22 | #include "mode.h" | 21 | #include "mode.h" |
23 | #include "os.h" | 22 | #include "os.h" |
24 | 23 | ||
@@ -35,8 +34,8 @@ unsigned long long sched_clock(void) | |||
35 | return (unsigned long long)jiffies_64 * (1000000000 / HZ); | 34 | return (unsigned long long)jiffies_64 * (1000000000 / HZ); |
36 | } | 35 | } |
37 | 36 | ||
38 | static unsigned long long prev_nsecs[NR_CPUS]; | ||
39 | #ifdef CONFIG_UML_REAL_TIME_CLOCK | 37 | #ifdef CONFIG_UML_REAL_TIME_CLOCK |
38 | static unsigned long long prev_nsecs[NR_CPUS]; | ||
40 | static long long delta[NR_CPUS]; /* Deviation per interval */ | 39 | static long long delta[NR_CPUS]; /* Deviation per interval */ |
41 | #endif | 40 | #endif |
42 | 41 | ||
@@ -95,7 +94,12 @@ irqreturn_t um_timer(int irq, void *dev) | |||
95 | 94 | ||
96 | do_timer(1); | 95 | do_timer(1); |
97 | 96 | ||
97 | #ifdef CONFIG_UML_REAL_TIME_CLOCK | ||
98 | nsecs = get_time(); | 98 | nsecs = get_time(); |
99 | #else | ||
100 | nsecs = (unsigned long long) xtime.tv_sec * BILLION + xtime.tv_nsec + | ||
101 | BILLION / HZ; | ||
102 | #endif | ||
99 | xtime.tv_sec = nsecs / NSEC_PER_SEC; | 103 | xtime.tv_sec = nsecs / NSEC_PER_SEC; |
100 | xtime.tv_nsec = nsecs - xtime.tv_sec * NSEC_PER_SEC; | 104 | xtime.tv_nsec = nsecs - xtime.tv_sec * NSEC_PER_SEC; |
101 | 105 | ||
@@ -128,13 +132,18 @@ void time_init(void) | |||
128 | nsecs = os_nsecs(); | 132 | nsecs = os_nsecs(); |
129 | set_normalized_timespec(&wall_to_monotonic, -nsecs / BILLION, | 133 | set_normalized_timespec(&wall_to_monotonic, -nsecs / BILLION, |
130 | -nsecs % BILLION); | 134 | -nsecs % BILLION); |
135 | set_normalized_timespec(&xtime, nsecs / BILLION, nsecs % BILLION); | ||
131 | late_time_init = register_timer; | 136 | late_time_init = register_timer; |
132 | } | 137 | } |
133 | 138 | ||
134 | void do_gettimeofday(struct timeval *tv) | 139 | void do_gettimeofday(struct timeval *tv) |
135 | { | 140 | { |
141 | #ifdef CONFIG_UML_REAL_TIME_CLOCK | ||
136 | unsigned long long nsecs = get_time(); | 142 | unsigned long long nsecs = get_time(); |
137 | 143 | #else | |
144 | unsigned long long nsecs = (unsigned long long) xtime.tv_sec * BILLION + | ||
145 | xtime.tv_nsec; | ||
146 | #endif | ||
138 | tv->tv_sec = nsecs / NSEC_PER_SEC; | 147 | tv->tv_sec = nsecs / NSEC_PER_SEC; |
139 | /* Careful about calculations here - this was originally done as | 148 | /* Careful about calculations here - this was originally done as |
140 | * (nsecs - tv->tv_sec * NSEC_PER_SEC) / NSEC_PER_USEC | 149 | * (nsecs - tv->tv_sec * NSEC_PER_SEC) / NSEC_PER_USEC |