aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2009-06-24 14:42:30 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-06-29 08:52:49 -0500
commit134b5339bed53fa185470c04b2936d58e3fc3695 (patch)
treeca94b642532ebc3fd4de8f05af8b43bf179a53ec
parentc825316027e32a0f035c1f9c521dd51320856188 (diff)
downloadslirp-134b5339bed53fa185470c04b2936d58e3fc3695.zip
slirp-134b5339bed53fa185470c04b2936d58e3fc3695.tar.gz
slirp-134b5339bed53fa185470c04b2936d58e3fc3695.tar.bz2
slirp: Clean up updtime
Drop redundant typecasts in both variants and remove the pointless round-up in the UNIX version. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--main.h1
-rw-r--r--slirp.c13
2 files changed, 5 insertions, 9 deletions
diff --git a/main.h b/main.h
index 087b978..1371e81 100644
--- a/main.h
+++ b/main.h
@@ -11,7 +11,6 @@
#define TOWRITEMAX 512
-extern struct timeval tt;
extern int link_up;
extern int slirp_socket;
extern int slirp_socket_unit;
diff --git a/slirp.c b/slirp.c
index 9fb891d..23fd55a 100644
--- a/slirp.c
+++ b/slirp.c
@@ -54,7 +54,6 @@ static const uint8_t zero_ethaddr[6] = { 0, 0, 0, 0, 0, 0 };
int slirp_restrict;
static int do_slowtimo;
int link_up;
-struct timeval tt;
struct ex_list *exec_list;
/* XXX: suppress those select globals */
@@ -254,19 +253,17 @@ static void updtime(void)
struct _timeb tb;
_ftime(&tb);
- curtime = (u_int)tb.time * (u_int)1000;
- curtime += (u_int)tb.millitm;
+
+ curtime = tb.time * 1000 + tb.millitm;
}
#else
static void updtime(void)
{
- gettimeofday(&tt, NULL);
+ struct timeval tv;
- curtime = (u_int)tt.tv_sec * (u_int)1000;
- curtime += (u_int)tt.tv_usec / (u_int)1000;
+ gettimeofday(&tv, NULL);
- if ((tt.tv_usec % 1000) >= 500)
- curtime++;
+ curtime = tv.tv_sec * 1000 + tv.tv_usec / 1000;
}
#endif