< prev index next >
src/java.base/unix/native/libnet/net_util_md.c
Print this page
*** 31,40 ****
--- 31,41 ----
#include <netinet/in.h>
#include <net/if.h>
#include <netdb.h>
#include <stdlib.h>
#include <dlfcn.h>
+ #include <sys/time.h>
#ifndef _ALLBSD_SOURCE
#include <values.h>
#else
#include <limits.h>
*** 1667,1671 ****
--- 1668,1687 ----
} /* while */
return timeout;
}
+
+ long NET_GetCurrentTime() {
+ struct timeval time;
+ gettimeofday(&time, NULL);
+ return (time.tv_sec * 1000 + time.tv_usec / 1000);
+ }
+
+ int NET_TimeoutWithCurrentTime(int s, long timeout, long currentTime) {
+ return NET_Timeout0(s, timeout, currentTime);
+ }
+
+ int NET_Timeout(int s, long timeout) {
+ long currentTime = (timeout > 0) ? NET_GetCurrentTime() : 0;
+ return NET_Timeout0(s, timeout, currentTime);
+ }
< prev index next >