space -> TAB
This commit is contained in:
parent
9ba9477c1a
commit
2853ff9bb9
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: clock.c,v 1.6 2001/07/07 15:27:21 tsutsui Exp $ */
|
/* $NetBSD: clock.c,v 1.7 2001/10/11 14:01:36 tsutsui Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1992, 1993
|
* Copyright (c) 1992, 1993
|
||||||
@ -83,7 +83,6 @@ timer_config(initfunc)
|
|||||||
cpu_initclocks_hook = initfunc;
|
cpu_initclocks_hook = initfunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set up the real-time and statistics clocks. Leave stathz 0 only
|
* Set up the real-time and statistics clocks. Leave stathz 0 only
|
||||||
* if no alternative timer is available.
|
* if no alternative timer is available.
|
||||||
@ -164,45 +163,44 @@ void
|
|||||||
inittodr(base)
|
inittodr(base)
|
||||||
time_t base;
|
time_t base;
|
||||||
{
|
{
|
||||||
int badbase = 0, waszero = (base == 0);
|
int badbase = 0, waszero = (base == 0);
|
||||||
|
|
||||||
if (base < 5 * SECYR) {
|
if (base < 5 * SECYR) {
|
||||||
/*
|
/*
|
||||||
* If base is 0, assume filesystem time is just unknown
|
* If base is 0, assume filesystem time is just unknown
|
||||||
* in stead of preposterous. Don't bark.
|
* in stead of preposterous. Don't bark.
|
||||||
*/
|
*/
|
||||||
if (base != 0)
|
if (base != 0)
|
||||||
printf("WARNING: preposterous time in file system\n");
|
printf("WARNING: preposterous time in file system\n");
|
||||||
/* not going to use it anyway, if the chip is readable */
|
/* not going to use it anyway, if the chip is readable */
|
||||||
/* 1991/07/01 12:00:00 */
|
/* 1991/07/01 12:00:00 */
|
||||||
base = 21*SECYR + 186*SECDAY + SECDAY/2;
|
base = 21*SECYR + 186*SECDAY + SECDAY/2;
|
||||||
badbase = 1;
|
badbase = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (todr_gettime(todr_handle, (struct timeval *)&time) != 0 ||
|
if (todr_gettime(todr_handle, (struct timeval *)&time) != 0 ||
|
||||||
time.tv_sec == 0) {
|
time.tv_sec == 0) {
|
||||||
printf("WARNING: bad date in battery clock");
|
printf("WARNING: bad date in battery clock");
|
||||||
/*
|
/*
|
||||||
* Believe the time in the file system for lack of
|
* Believe the time in the file system for lack of
|
||||||
* anything better, resetting the clock.
|
* anything better, resetting the clock.
|
||||||
*/
|
*/
|
||||||
time.tv_sec = base;
|
time.tv_sec = base;
|
||||||
if (!badbase)
|
if (!badbase)
|
||||||
resettodr();
|
resettodr();
|
||||||
} else {
|
} else {
|
||||||
int deltat = time.tv_sec - base;
|
int deltat = time.tv_sec - base;
|
||||||
|
|
||||||
if (deltat < 0)
|
if (deltat < 0)
|
||||||
deltat = -deltat;
|
deltat = -deltat;
|
||||||
if (waszero || deltat < 2 * SECDAY)
|
if (waszero || deltat < 2 * SECDAY)
|
||||||
return;
|
return;
|
||||||
printf("WARNING: clock %s %d days",
|
printf("WARNING: clock %s %d days",
|
||||||
time.tv_sec < base ? "lost" : "gained", deltat / SECDAY);
|
time.tv_sec < base ? "lost" : "gained", deltat / SECDAY);
|
||||||
}
|
}
|
||||||
printf(" -- CHECK AND RESET THE DATE!\n");
|
printf(" -- CHECK AND RESET THE DATE!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reset the clock based on the current time.
|
* Reset the clock based on the current time.
|
||||||
* Used when the current clock is preposterous, when the time is changed,
|
* Used when the current clock is preposterous, when the time is changed,
|
||||||
|
Loading…
Reference in New Issue
Block a user