Commit d475d5a9 authored by Richard Henderson's avatar Richard Henderson

[ALPHA] Set wall_to_monotonic on timer_init and settimeofday.

parent 424544a4
...@@ -371,6 +371,9 @@ time_init(void) ...@@ -371,6 +371,9 @@ time_init(void)
xtime.tv_sec = mktime(year, mon, day, hour, min, sec); xtime.tv_sec = mktime(year, mon, day, hour, min, sec);
xtime.tv_nsec = 0; xtime.tv_nsec = 0;
wall_to_monotonic.tv_sec -= xtime.tv_sec;
wall_to_monotonic.tv_nsec = 0;
if (HZ > (1<<16)) { if (HZ > (1<<16)) {
extern void __you_loose (void); extern void __you_loose (void);
__you_loose(); __you_loose();
...@@ -486,6 +489,16 @@ do_settimeofday(struct timespec *tv) ...@@ -486,6 +489,16 @@ do_settimeofday(struct timespec *tv)
time_maxerror = NTP_PHASE_LIMIT; time_maxerror = NTP_PHASE_LIMIT;
time_esterror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT;
wall_to_monotonic.tv_sec += xtime.tv_sec - tv->tv_sec;
wall_to_monotonic.tv_nsec += xtime.tv_nsec - tv->tv_nsec;
if (wall_to_monotonic.tv_nsec > NSEC_PER_SEC) {
wall_to_monotonic.tv_nsec -= NSEC_PER_SEC;
wall_to_monotonic.tv_sec++;
} else if (wall_to_monotonic.tv_nsec < 0) {
wall_to_monotonic.tv_nsec += NSEC_PER_SEC;
wall_to_monotonic.tv_sec--;
}
write_sequnlock_irq(&xtime_lock); write_sequnlock_irq(&xtime_lock);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment