Skip to content

Commit

Permalink
slirp: Clean up updtime
Browse files Browse the repository at this point in the history
Drop redundant typecasts in both variants and remove the pointless
round-up in the UNIX version.

Signed-off-by: Jan Kiszka <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
  • Loading branch information
jan-kiszka authored and Anthony Liguori committed Jun 29, 2009
1 parent 285f7a6 commit 8ec7f4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
1 change: 0 additions & 1 deletion slirp/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#define TOWRITEMAX 512

extern struct timeval tt;
extern int link_up;
extern int slirp_socket;
extern int slirp_socket_unit;
Expand Down
13 changes: 5 additions & 8 deletions slirp/slirp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 8ec7f4e

Please sign in to comment.