Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 105605
b: refs/heads/master
c: 95469bd
h: refs/heads/master
i:
  105603: a1c497c
v: v3
  • Loading branch information
Sebastian Siewior authored and Greg Ungerer committed Jul 23, 2008
1 parent 5798b12 commit 4259146
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0df185f5a1430ab8b437be402d286ee0728ef9f8
refs/heads/master: 95469bd64a7a9ab405b566deb8c81d4aaf67ed9e
4 changes: 4 additions & 0 deletions trunk/arch/m68knommu/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ config GENERIC_TIME
bool
default y

config GENERIC_CMOS_UPDATE
bool
default y

config TIME_LOW_RES
bool
default y
Expand Down
38 changes: 10 additions & 28 deletions trunk/arch/m68knommu/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,6 @@ static inline int set_rtc_mmss(unsigned long nowtime)
return -1;
}

static inline void do_set_rtc(void)
{
/* last time the cmos clock got updated */
static long last_rtc_update=0;

/*
* If we have an externally synchronized Linux clock, then update
* CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
* called as close as possible to 500 ms before the new second starts.
*/
if (ntp_synced() &&
xtime.tv_sec > last_rtc_update + 660 &&
(xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
(xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
if (set_rtc_mmss(xtime.tv_sec) == 0)
last_rtc_update = xtime.tv_sec;
else
last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
}
}

/*
* timer_interrupt() needs to keep up the real-time clock,
* as well as call the "do_timer()" routine every clocktick
Expand All @@ -68,8 +47,6 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy)

do_timer(1);

do_set_rtc();

write_sequnlock(&xtime_lock);

#ifndef CONFIG_SMP
Expand All @@ -93,12 +70,17 @@ static unsigned long read_rtc_mmss(void)
return mktime(year, mon, day, hour, min, sec);;
}

void time_init(void)
unsigned long read_persistent_clock(void)
{
return read_rtc_mmss();
}

int update_persistent_clock(struct timespec now)
{
xtime.tv_sec = read_rtc_mmss();
xtime.tv_nsec = 0;
wall_to_monotonic.tv_sec = -xtime.tv_sec;
return set_rtc_mmss(now.tv_sec);
}

void time_init(void)
{
hw_timer_init();
}

0 comments on commit 4259146

Please sign in to comment.