Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/newsmips/newsmips workaround for volatile struct ti...
details: https://anonhg.NetBSD.org/src/rev/adb532adf8e5
branches: trunk
changeset: 581650:adb532adf8e5
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Fri Jun 03 13:45:28 2005 +0000
description:
workaround for volatile struct timeval time vs todr_*() arg mismatch.
diffstat:
sys/arch/newsmips/newsmips/clock.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diffs (63 lines):
diff -r feee27797540 -r adb532adf8e5 sys/arch/newsmips/newsmips/clock.c
--- a/sys/arch/newsmips/newsmips/clock.c Fri Jun 03 13:44:50 2005 +0000
+++ b/sys/arch/newsmips/newsmips/clock.c Fri Jun 03 13:45:28 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.11 2005/02/06 02:18:02 tsutsui Exp $ */
+/* $NetBSD: clock.c,v 1.12 2005/06/03 13:45:28 tsutsui Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.11 2005/02/06 02:18:02 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.12 2005/06/03 13:45:28 tsutsui Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -102,6 +102,7 @@
void
inittodr(time_t base)
{
+ struct timeval tv;
int badbase, waszero;
badbase = 0;
@@ -120,8 +121,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
@@ -131,7 +132,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;
@@ -152,10 +156,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