Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
e22ae157
Commit
e22ae157
authored
Sep 29, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid using gettimeofday.
parent
c3421ea4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
icmp_main.c
dlls/icmp/icmp_main.c
+9
-10
No files found.
dlls/icmp/icmp_main.c
View file @
e22ae157
...
@@ -210,7 +210,8 @@ DWORD WINAPI IcmpSendEcho(
...
@@ -210,7 +210,8 @@ DWORD WINAPI IcmpSendEcho(
int
ip_header_len
;
int
ip_header_len
;
int
maxlen
;
int
maxlen
;
fd_set
fdr
;
fd_set
fdr
;
struct
timeval
timeout
,
send_time
,
recv_time
;
struct
timeval
timeout
;
DWORD
send_time
,
recv_time
;
struct
sockaddr_in
addr
;
struct
sockaddr_in
addr
;
int
addrlen
;
int
addrlen
;
unsigned
short
id
,
seq
,
cksum
;
unsigned
short
id
,
seq
,
cksum
;
...
@@ -313,7 +314,7 @@ DWORD WINAPI IcmpSendEcho(
...
@@ -313,7 +314,7 @@ DWORD WINAPI IcmpSendEcho(
}
}
#endif
#endif
gettimeofday
(
&
send_time
,
NULL
);
send_time
=
GetTickCount
(
);
res
=
sendto
(
icp
->
sid
,
reqbuf
,
reqsize
,
0
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
));
res
=
sendto
(
icp
->
sid
,
reqbuf
,
reqsize
,
0
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
));
HeapFree
(
GetProcessHeap
(),
0
,
reqbuf
);
HeapFree
(
GetProcessHeap
(),
0
,
reqbuf
);
if
(
res
<
0
)
{
if
(
res
<
0
)
{
...
@@ -338,7 +339,7 @@ DWORD WINAPI IcmpSendEcho(
...
@@ -338,7 +339,7 @@ DWORD WINAPI IcmpSendEcho(
/* Get the reply */
/* Get the reply */
ip_header_len
=
0
;
/* because gcc was complaining */
ip_header_len
=
0
;
/* because gcc was complaining */
while
((
res
=
select
(
icp
->
sid
+
1
,
&
fdr
,
NULL
,
NULL
,
&
timeout
))
>
0
)
{
while
((
res
=
select
(
icp
->
sid
+
1
,
&
fdr
,
NULL
,
NULL
,
&
timeout
))
>
0
)
{
gettimeofday
(
&
recv_time
,
NULL
);
recv_time
=
GetTickCount
(
);
res
=
recvfrom
(
icp
->
sid
,
(
char
*
)
ip_header
,
maxlen
,
0
,
(
struct
sockaddr
*
)
&
addr
,
&
addrlen
);
res
=
recvfrom
(
icp
->
sid
,
(
char
*
)
ip_header
,
maxlen
,
0
,
(
struct
sockaddr
*
)
&
addr
,
&
addrlen
);
TRACE
(
"received %d bytes from %s
\n
"
,
res
,
inet_ntoa
(
addr
.
sin_addr
));
TRACE
(
"received %d bytes from %s
\n
"
,
res
,
inet_ntoa
(
addr
.
sin_addr
));
ier
->
Status
=
IP_REQ_TIMED_OUT
;
ier
->
Status
=
IP_REQ_TIMED_OUT
;
...
@@ -432,18 +433,16 @@ DWORD WINAPI IcmpSendEcho(
...
@@ -432,18 +433,16 @@ DWORD WINAPI IcmpSendEcho(
* Decrease the timeout so that we don't enter an endless loop even
* Decrease the timeout so that we don't enter an endless loop even
* if we get flooded with ICMP packets that are not for us.
* if we get flooded with ICMP packets that are not for us.
*/
*/
timeout
.
tv_sec
=
Timeout
/
1000
-
(
recv_time
.
tv_sec
-
send_time
.
tv_sec
);
int
t
=
Timeout
-
(
recv_time
-
send_time
);
timeout
.
tv_usec
=
(
Timeout
%
1000
)
*
1000
+
send_time
.
tv_usec
-
(
recv_time
.
tv_usec
-
send_time
.
tv_usec
);
if
(
t
<
0
)
t
=
0
;
if
(
timeout
.
tv_usec
<
0
)
{
timeout
.
tv_sec
=
t
/
1000
;
timeout
.
tv_usec
+=
1000000
;
timeout
.
tv_usec
=
(
t
%
1000
)
*
1000
;
timeout
.
tv_sec
--
;
}
continue
;
continue
;
}
else
{
}
else
{
/* This is a reply to our packet */
/* This is a reply to our packet */
memcpy
(
&
ier
->
Address
,
&
ip_header
->
ip_src
,
sizeof
(
IPAddr
));
memcpy
(
&
ier
->
Address
,
&
ip_header
->
ip_src
,
sizeof
(
IPAddr
));
/* Status is already set */
/* Status is already set */
ier
->
RoundTripTime
=
(
recv_time
.
tv_sec
-
send_time
.
tv_sec
)
*
1000
+
(
recv_time
.
tv_usec
-
send_time
.
tv_usec
)
/
1000
;
ier
->
RoundTripTime
=
recv_time
-
send_time
;
ier
->
DataSize
=
res
-
ip_header_len
-
ICMP_MINLEN
;
ier
->
DataSize
=
res
-
ip_header_len
-
ICMP_MINLEN
;
ier
->
Reserved
=
0
;
ier
->
Reserved
=
0
;
ier
->
Data
=
endbuf
-
ier
->
DataSize
;
ier
->
Data
=
endbuf
-
ier
->
DataSize
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment