diff options
Diffstat (limited to 'core/network.c')
-rw-r--r-- | core/network.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/core/network.c b/core/network.c index d5389bfa..70536abf 100644 --- a/core/network.c +++ b/core/network.c | |||
@@ -24,12 +24,26 @@ | |||
24 | 24 | ||
25 | #include "network.h" | 25 | #include "network.h" |
26 | 26 | ||
27 | |||
28 | //returns current time in milleseconds since the epoch. | ||
29 | uint64_t current_time() | ||
30 | { | ||
31 | uint64_t time; | ||
32 | #ifdef WIN32 | ||
33 | //TODO: windows version | ||
34 | #else | ||
35 | struct timeval a; | ||
36 | gettimeofday(&a, NULL); | ||
37 | time = 1000000UL*a.tv_sec + a.tv_usec; | ||
38 | #endif | ||
39 | return time; | ||
40 | |||
41 | } | ||
42 | |||
27 | //our UDP socket, a global variable. | 43 | //our UDP socket, a global variable. |
28 | static int sock; | 44 | static int sock; |
29 | 45 | ||
30 | //Basic network functions: | 46 | //Basic network functions: |
31 | //TODO: put them somewhere else than here | ||
32 | |||
33 | //Function to send packet(data) of length length to ip_port | 47 | //Function to send packet(data) of length length to ip_port |
34 | int sendpacket(IP_Port ip_port, char * data, uint32_t length) | 48 | int sendpacket(IP_Port ip_port, char * data, uint32_t length) |
35 | { | 49 | { |