Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hp300/hp300 Add workaround for volatile struct time...
details: https://anonhg.NetBSD.org/src/rev/1f482082267a
branches: trunk
changeset: 581578:1f482082267a
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Thu Jun 02 17:15:10 2005 +0000
description:
Add workaround for volatile struct timeval time vs. todr_*() function
prototype mismatch. Based on sparc64 fixes.
diffstat:
sys/arch/hp300/hp300/clock.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diffs (63 lines):
diff -r 4d032c79ed3f -r 1f482082267a sys/arch/hp300/hp300/clock.c
--- a/sys/arch/hp300/hp300/clock.c Thu Jun 02 17:14:43 2005 +0000
+++ b/sys/arch/hp300/hp300/clock.c Thu Jun 02 17:15:10 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.32 2005/05/23 14:54:13 tsutsui Exp $ */
+/* $NetBSD: clock.c,v 1.33 2005/06/02 17:15:10 tsutsui Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
@@ -85,7 +85,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.32 2005/05/23 14:54:13 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.33 2005/06/02 17:15:10 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -398,6 +398,7 @@
void
inittodr(time_t base)
{
+ struct timeval tv;
int badbase = 0, waszero = (base == 0);
if (base < 5 * SECYR) {
@@ -413,8 +414,8 @@
badbase = 1;
}
- if (todr_gettime(todr_handle, (struct timeval *)&time) != 0 ||
- time.tv_sec == 0) {
+ if (todr_gettime(todr_handle, &tv) != 0 ||
+ tv.tv_sec == 0) {
printf("WARNING: bad date in battery clock");
/*
* Believe the time in the file system for lack of
@@ -424,7 +425,10 @@
if (!badbase)
resettodr();
} else {
- int deltat = time.tv_sec - base;
+ int deltat;
+
+ time = tv;
+ deltat = time.tv_sec - base;
if (deltat < 0)
deltat = -deltat;
@@ -445,9 +449,12 @@
void
resettodr(void)
{
+ struct timeval tv;
+
if (time.tv_sec == 0)
return;
- if (todr_settime(todr_handle, (struct timeval *)&time) != 0)
+ tv = time;
+ if (todr_settime(todr_handle, &tv) != 0)
printf("resettodr: cannot set time in time-of-day clock\n");
}
Home |
Main Index |
Thread Index |
Old Index