aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m68knommu')
-rw-r--r--arch/m68knommu/kernel/time.c57
1 files changed, 0 insertions, 57 deletions
diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c
index 207a55bdde98..89cdbcaeb45f 100644
--- a/arch/m68knommu/kernel/time.c
+++ b/arch/m68knommu/kernel/time.c
@@ -88,60 +88,3 @@ void time_init(void)
88 hw_timer_init(); 88 hw_timer_init();
89} 89}
90 90
91/*
92 * This version of gettimeofday has near microsecond resolution.
93 */
94void do_gettimeofday(struct timeval *tv)
95{
96 unsigned long flags;
97 unsigned long seq;
98 unsigned long usec, sec;
99
100 do {
101 seq = read_seqbegin_irqsave(&xtime_lock, flags);
102 usec = hw_timer_offset();
103 sec = xtime.tv_sec;
104 usec += (xtime.tv_nsec / 1000);
105 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
106
107 while (usec >= 1000000) {
108 usec -= 1000000;
109 sec++;
110 }
111
112 tv->tv_sec = sec;
113 tv->tv_usec = usec;
114}
115
116EXPORT_SYMBOL(do_gettimeofday);
117
118int do_settimeofday(struct timespec *tv)
119{
120 time_t wtm_sec, sec = tv->tv_sec;
121 long wtm_nsec, nsec = tv->tv_nsec;
122
123 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
124 return -EINVAL;
125
126 write_seqlock_irq(&xtime_lock);
127 /*
128 * This is revolting. We need to set the xtime.tv_usec
129 * correctly. However, the value in this location is
130 * is value at the last tick.
131 * Discover what correction gettimeofday
132 * would have done, and then undo it!
133 */
134 nsec -= (hw_timer_offset() * 1000);
135
136 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
137 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
138
139 set_normalized_timespec(&xtime, sec, nsec);
140 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
141
142 ntp_clear();
143 write_sequnlock_irq(&xtime_lock);
144 clock_was_set();
145 return 0;
146}
147EXPORT_SYMBOL(do_settimeofday);