From 8ec7f4edcfcca6ef5d197f1d9323137ece5f7a89 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Wed, 24 Jun 2009 14:42:30 +0200 Subject: 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 Signed-off-by: Anthony Liguori --- slirp/slirp.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'slirp/slirp.c') diff --git a/slirp/slirp.c b/slirp/slirp.c index 02f6fe50fc..20c691f3e3 100644 --- a/slirp/slirp.c +++ b/slirp/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 */ @@ -250,19 +249,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 -- cgit v1.2.1