aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/kernel/time.c')
-rw-r--r--arch/um/kernel/time.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index 758d4f9cb22a..7678bcf830ba 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -123,46 +123,6 @@ void time_init(void)
123 late_time_init = register_timer; 123 late_time_init = register_timer;
124} 124}
125 125
126void do_gettimeofday(struct timeval *tv)
127{
128#ifdef CONFIG_UML_REAL_TIME_CLOCK
129 unsigned long long nsecs = get_time();
130#else
131 unsigned long long nsecs = (unsigned long long) xtime.tv_sec * BILLION +
132 xtime.tv_nsec;
133#endif
134 tv->tv_sec = nsecs / NSEC_PER_SEC;
135 /*
136 * Careful about calculations here - this was originally done as
137 * (nsecs - tv->tv_sec * NSEC_PER_SEC) / NSEC_PER_USEC
138 * which gave bogus (> 1000000) values. Dunno why, suspect gcc
139 * (4.0.0) miscompiled it, or there's a subtle 64/32-bit conversion
140 * problem that I missed.
141 */
142 nsecs -= tv->tv_sec * NSEC_PER_SEC;
143 tv->tv_usec = (unsigned long) nsecs / NSEC_PER_USEC;
144}
145
146static inline void set_time(unsigned long long nsecs)
147{
148 unsigned long long now;
149 unsigned long flags;
150
151 spin_lock_irqsave(&timer_spinlock, flags);
152 now = os_nsecs();
153 local_offset = nsecs - now;
154 spin_unlock_irqrestore(&timer_spinlock, flags);
155
156 clock_was_set();
157}
158
159int do_settimeofday(struct timespec *tv)
160{
161 set_time((unsigned long long) tv->tv_sec * NSEC_PER_SEC + tv->tv_nsec);
162
163 return 0;
164}
165
166void timer_handler(int sig, struct uml_pt_regs *regs) 126void timer_handler(int sig, struct uml_pt_regs *regs)
167{ 127{
168 if (current_thread->cpu == 0) 128 if (current_thread->cpu == 0)