Revert previous and fix the todr_gettime() / todr_settime() problem
differently, simply by removing the now unneccessary cast.
This commit is contained in:
parent
ee2fad4551
commit
6082beaaf9
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: clock.c,v 1.12 2005/06/03 13:45:28 tsutsui Exp $ */
|
||||
/* $NetBSD: clock.c,v 1.13 2005/06/05 11:29:06 he Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.12 2005/06/03 13:45:28 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.13 2005/06/05 11:29:06 he Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -102,7 +102,6 @@ setstatclockrate(int newhz)
|
||||
void
|
||||
inittodr(time_t base)
|
||||
{
|
||||
struct timeval tv;
|
||||
int badbase, waszero;
|
||||
|
||||
badbase = 0;
|
||||
@ -121,8 +120,8 @@ inittodr(time_t base)
|
||||
badbase = 1;
|
||||
}
|
||||
|
||||
if (todr_gettime(todr_handle, &tv) != 0 ||
|
||||
tv.tv_sec == 0) {
|
||||
if (todr_gettime(todr_handle, &time) != 0 ||
|
||||
time.tv_sec == 0) {
|
||||
printf("WARNING: bad date in battery clock");
|
||||
/*
|
||||
* Believe the time in the file system for lack of
|
||||
@ -132,10 +131,7 @@ inittodr(time_t base)
|
||||
if (!badbase)
|
||||
resettodr();
|
||||
} else {
|
||||
int deltat;
|
||||
|
||||
time = tv;
|
||||
deltat = time.tv_sec - base;
|
||||
int deltat = time.tv_sec - base;
|
||||
|
||||
if (deltat < 0)
|
||||
deltat = -deltat;
|
||||
@ -156,12 +152,10 @@ inittodr(time_t base)
|
||||
void
|
||||
resettodr(void)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
if (time.tv_sec == 0)
|
||||
return;
|
||||
|
||||
tv = time;
|
||||
if (todr_settime(todr_handle, &tv) != 0)
|
||||
if (todr_settime(todr_handle, &time) != 0)
|
||||
printf("resettodr: cannot set time in time-of-day clock\n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user