From d0ed1639144a5f3358d8bc69ad0885d0c1133877 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Thu, 27 Jun 2013 07:37:06 -0400 Subject: Fixed something in the DHT, added a milisecond time function. --- core/network.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'core/network.c') 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 @@ #include "network.h" + +//returns current time in milleseconds since the epoch. +uint64_t current_time() +{ + uint64_t time; + #ifdef WIN32 + //TODO: windows version + #else + struct timeval a; + gettimeofday(&a, NULL); + time = 1000000UL*a.tv_sec + a.tv_usec; + #endif + return time; + +} + //our UDP socket, a global variable. static int sock; //Basic network functions: -//TODO: put them somewhere else than here - //Function to send packet(data) of length length to ip_port int sendpacket(IP_Port ip_port, char * data, uint32_t length) { -- cgit v1.2.3