commit f48c203edfc61993069c2cca06ff6e69c54b1fa6 parent 688036dc8def49459da6a1de3b4eedc896be9ac8 Author: Michael Savage <mikejsavage@gmail.com> Date: Wed Jan 18 23:52:28 +0200 Use platform_time in the server Diffstat:
server/main.cc | | | 9 | +-------- |
diff --git a/server/main.cc b/server/main.cc @@ -1,7 +1,6 @@ #include <stdio.h> #include <errno.h> #include <err.h> -#include <time.h> #include "intrinsics.h" #include "log.h" @@ -13,6 +12,7 @@ #include "rng/well512.h" #include "platform_io.h" #include "platform_network.h" +#include "platform_time.h" #define PORT 13337 #define MAX_PLAYERS 128 @@ -87,13 +87,6 @@ static void send( int fd, const PlayerState * state, const WriteStream & ws ) { sendto( fd, ws.start, ws.len(), 0, ( sockaddr * ) &state->addr, sizeof( state->addr ) ); } -static double get_time() { - struct timespec ts; - clock_gettime( CLOCK_MONOTONIC, &ts ); - - return double( ts.tv_sec ) + double( ts.tv_nsec ) / 1000000000.0; -} - int main() { int server_fd_ipv4 = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP ); int server_fd_ipv6 = socket( AF_INET6, SOCK_DGRAM, IPPROTO_UDP );