Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/ping we need difftime to return a signed result, so cla...
details: https://anonhg.NetBSD.org/src/rev/6be33f253959
branches: trunk
changeset: 768556:6be33f253959
user: christos <christos%NetBSD.org@localhost>
date: Sat Aug 20 14:38:09 2011 +0000
description:
we need difftime to return a signed result, so clamp the timeval's to
uint32_t but then, return a signed result of their difference.
diffstat:
sbin/ping/ping.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (29 lines):
diff -r fbe0799407f2 -r 6be33f253959 sbin/ping/ping.c
--- a/sbin/ping/ping.c Sat Aug 20 09:18:47 2011 +0000
+++ b/sbin/ping/ping.c Sat Aug 20 14:38:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ping.c,v 1.95 2011/08/19 08:35:40 christos Exp $ */
+/* $NetBSD: ping.c,v 1.96 2011/08/20 14:38:09 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -58,7 +58,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ping.c,v 1.95 2011/08/19 08:35:40 christos Exp $");
+__RCSID("$NetBSD: ping.c,v 1.96 2011/08/20 14:38:09 christos Exp $");
#endif
#include <stdio.h>
@@ -1242,8 +1242,8 @@
diffsec(struct timeval *timenow,
struct timeval *then)
{
- return ((uint32_t)(timenow->tv_sec - then->tv_sec) * 1.0
- + (timenow->tv_usec - then->tv_usec)/1000000.0);
+ return ((int32_t)((uint32_t)timenow->tv_sec - (uint32_t)then->tv_sec)
+ * 1.0 + (timenow->tv_usec - then->tv_usec)/1000000.0);
}
Home |
Main Index |
Thread Index |
Old Index