diff options
author | 2013-07-05 20:30:56 +0000 | |
---|---|---|
committer | 2013-07-05 20:30:56 +0000 | |
commit | 75f2bbf0091f56ec890675b7d9d73139ab7d305f (patch) | |
tree | 3b7be8faf46ecdbb0c874175d2b5cb8f74e88e2f /sys/arch/sparc | |
parent | Take II, this time without flubbing off_t: : move several internal (diff) | |
download | wireguard-openbsd-75f2bbf0091f56ec890675b7d9d73139ab7d305f.tar.xz wireguard-openbsd-75f2bbf0091f56ec890675b7d9d73139ab7d305f.zip |
Avoid truncation when calculating clock gain/loss
ok deraadt@
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r-- | sys/arch/sparc/sparc/clock.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/arch/sparc/sparc/clock.c b/sys/arch/sparc/sparc/clock.c index 56eee62e412..bf596958c5a 100644 --- a/sys/arch/sparc/sparc/clock.c +++ b/sys/arch/sparc/sparc/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.27 2012/11/05 13:20:16 miod Exp $ */ +/* $OpenBSD: clock.c,v 1.28 2013/07/05 20:30:56 guenther Exp $ */ /* $NetBSD: clock.c,v 1.52 1997/05/24 20:16:05 pk Exp $ */ /* @@ -919,7 +919,7 @@ forward: if (!badbase) resettodr(); } else { - int deltat = ts.tv_sec - base; + time_t deltat = ts.tv_sec - base; tc_setclock(&ts); if (deltat < 0) @@ -928,8 +928,9 @@ forward: return; #ifndef SMALL_KERNEL - printf("WARNING: clock %s %d days", - ts.tv_sec < base ? "lost" : "gained", deltat / SECDAY); + printf("WARNING: clock %s %lld days", + ts.tv_sec < base ? "lost" : "gained", + (long long)(deltat / SECDAY)); bad = ""; #endif } |