summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sparc64/sparc64/clock.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/arch/sparc64/sparc64/clock.c b/sys/arch/sparc64/sparc64/clock.c
index 18efa11bcad..87c15e03b70 100644
--- a/sys/arch/sparc64/sparc64/clock.c
+++ b/sys/arch/sparc64/sparc64/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.50 2014/01/30 00:51:13 dlg Exp $ */
+/* $OpenBSD: clock.c,v 1.51 2014/02/08 11:04:50 kettenis Exp $ */
/* $NetBSD: clock.c,v 1.41 2001/07/24 19:29:25 eeh Exp $ */
/*
@@ -899,14 +899,15 @@ int sparc_clock_time_is_ok;
* Set up the system's time, given a `reasonable' time value.
*/
void
-inittodr(base)
- time_t base;
+inittodr(time_t base)
{
int badbase = 0, waszero = base == 0;
char *bad = NULL;
struct timeval tv;
struct timespec ts;
+ tv.tv_sec = tv.tv_usec = 0;
+
if (base < 5 * SECYR) {
/*
* If base is 0, assume filesystem time is just unknown
@@ -919,8 +920,10 @@ inittodr(base)
badbase = 1;
}
- if (todr_handle && (todr_gettime(todr_handle, &tv) != 0 ||
- tv.tv_sec == 0)) {
+ if (todr_handle != NULL)
+ todr_gettime(todr_handle, &tv);
+
+ if (tv.tv_sec == 0) {
/*
* Believe the time in the file system for lack of
* anything better, resetting the clock.