Commit 8ec7f4edcfcca6ef5d197f1d9323137ece5f7a89
Committed by
Anthony Liguori
1 parent
285f7a62
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>
Showing
2 changed files
with
5 additions
and
9 deletions
slirp/main.h
slirp/slirp.c
... | ... | @@ -54,7 +54,6 @@ static const uint8_t zero_ethaddr[6] = { 0, 0, 0, 0, 0, 0 }; |
54 | 54 | int slirp_restrict; |
55 | 55 | static int do_slowtimo; |
56 | 56 | int link_up; |
57 | -struct timeval tt; | |
58 | 57 | struct ex_list *exec_list; |
59 | 58 | |
60 | 59 | /* XXX: suppress those select globals */ |
... | ... | @@ -250,19 +249,17 @@ static void updtime(void) |
250 | 249 | struct _timeb tb; |
251 | 250 | |
252 | 251 | _ftime(&tb); |
253 | - curtime = (u_int)tb.time * (u_int)1000; | |
254 | - curtime += (u_int)tb.millitm; | |
252 | + | |
253 | + curtime = tb.time * 1000 + tb.millitm; | |
255 | 254 | } |
256 | 255 | #else |
257 | 256 | static void updtime(void) |
258 | 257 | { |
259 | - gettimeofday(&tt, NULL); | |
258 | + struct timeval tv; | |
260 | 259 | |
261 | - curtime = (u_int)tt.tv_sec * (u_int)1000; | |
262 | - curtime += (u_int)tt.tv_usec / (u_int)1000; | |
260 | + gettimeofday(&tv, NULL); | |
263 | 261 | |
264 | - if ((tt.tv_usec % 1000) >= 500) | |
265 | - curtime++; | |
262 | + curtime = tv.tv_sec * 1000 + tv.tv_usec / 1000; | |
266 | 263 | } |
267 | 264 | #endif |
268 | 265 | ... | ... |