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