From 05f40afda4b3ee482ddacfc1968762a3ad2d27b0 Mon Sep 17 00:00:00 2001 From: elopes Date: Sun, 18 Feb 2018 20:34:18 +0100 Subject: [PATCH] final test sntp --- RIOT/examples/network_app_rtt_1/main.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/RIOT/examples/network_app_rtt_1/main.c b/RIOT/examples/network_app_rtt_1/main.c index 041c15c..e2041f2 100755 --- a/RIOT/examples/network_app_rtt_1/main.c +++ b/RIOT/examples/network_app_rtt_1/main.c @@ -120,8 +120,8 @@ void *sock_time_server_thread(void *arg) if ((res = sock_udp_recv(&sock_ntp,&sntp_packet, sizeof(sntp_packet), SOCK_NO_TIMEOUT, &remote)) >= 0) { sntp_packet.receive.seconds=byteorder_htonl( xtimer_now_usec()); - sntp_packet.origin.seconds=sntp_packet.transmit.seconds; - sntp_packet.transmit.seconds=byteorder_htonl( xtimer_now_usec()); + sntp_packet.origin.seconds=sntp_packet.transmit.seconds; + sntp_packet.transmit.seconds=byteorder_htonl( xtimer_now_usec()); if (sock_udp_send(&sock_ntp, &sntp_packet, sizeof(sntp_packet), &remote) < 0) { puts("Error sending reply"); @@ -131,13 +131,10 @@ void *sock_time_server_thread(void *arg) return NULL; } -uint32_t end,test; -//uint32_t time1, time2; -//char rbuf[MAXLEN], sbuf[MAXLEN], ack[MAXLEN]; - -typedef struct tableau { - uint32_t heure_actuelle; - char donnees[MAXLEN]; + +typedef struct list { + uint32_t send_time; + char packet[MAXLEN]; }Data; // calculate the time diff between start and end (in us) @@ -198,7 +195,7 @@ void *sock_server_thread(void *arg) { puts("Can't receive datagram\n"); } - deadline = xtimer_now_usec() + offset - buf.heure_actuelle; + deadline = xtimer_now_usec() + offset - buf.send_time; printf("tps de transmission : %i\n",deadline); //puts("Got a UDP datagram\n"); @@ -241,7 +238,7 @@ void *sock_client_thread(void *arg) { - data.heure_actuelle = xtimer_now_usec(); + data.send_time = xtimer_now_usec(); //test=xtimer_now_usec(); printf("Heure server: %" PRIu32 "\n",data.heure_actuelle); if (sock_udp_send(&sock,&data,sizeof(data), &remote) < 0) -- libgit2 0.21.2