Commit 05f40afda4b3ee482ddacfc1968762a3ad2d27b0
1 parent
f8d83614
final test sntp
Showing
1 changed file
with
8 additions
and
11 deletions
Show diff stats
RIOT/examples/network_app_rtt_1/main.c
... | ... | @@ -120,8 +120,8 @@ void *sock_time_server_thread(void *arg) |
120 | 120 | if ((res = sock_udp_recv(&sock_ntp,&sntp_packet, sizeof(sntp_packet), SOCK_NO_TIMEOUT, |
121 | 121 | &remote)) >= 0) { |
122 | 122 | sntp_packet.receive.seconds=byteorder_htonl( xtimer_now_usec()); |
123 | - sntp_packet.origin.seconds=sntp_packet.transmit.seconds; | |
124 | - sntp_packet.transmit.seconds=byteorder_htonl( xtimer_now_usec()); | |
123 | + sntp_packet.origin.seconds=sntp_packet.transmit.seconds; | |
124 | + sntp_packet.transmit.seconds=byteorder_htonl( xtimer_now_usec()); | |
125 | 125 | |
126 | 126 | if (sock_udp_send(&sock_ntp, &sntp_packet, sizeof(sntp_packet), &remote) < 0) { |
127 | 127 | puts("Error sending reply"); |
... | ... | @@ -131,13 +131,10 @@ void *sock_time_server_thread(void *arg) |
131 | 131 | return NULL; |
132 | 132 | } |
133 | 133 | |
134 | -uint32_t end,test; | |
135 | -//uint32_t time1, time2; | |
136 | -//char rbuf[MAXLEN], sbuf[MAXLEN], ack[MAXLEN]; | |
137 | - | |
138 | -typedef struct tableau { | |
139 | - uint32_t heure_actuelle; | |
140 | - char donnees[MAXLEN]; | |
134 | + | |
135 | +typedef struct list { | |
136 | + uint32_t send_time; | |
137 | + char packet[MAXLEN]; | |
141 | 138 | }Data; |
142 | 139 | |
143 | 140 | // calculate the time diff between start and end (in us) |
... | ... | @@ -198,7 +195,7 @@ void *sock_server_thread(void *arg) |
198 | 195 | { |
199 | 196 | puts("Can't receive datagram\n"); |
200 | 197 | } |
201 | - deadline = xtimer_now_usec() + offset - buf.heure_actuelle; | |
198 | + deadline = xtimer_now_usec() + offset - buf.send_time; | |
202 | 199 | printf("tps de transmission : %i\n",deadline); |
203 | 200 | |
204 | 201 | //puts("Got a UDP datagram\n"); |
... | ... | @@ -241,7 +238,7 @@ void *sock_client_thread(void *arg) |
241 | 238 | { |
242 | 239 | |
243 | 240 | |
244 | - data.heure_actuelle = xtimer_now_usec(); | |
241 | + data.send_time = xtimer_now_usec(); | |
245 | 242 | //test=xtimer_now_usec(); |
246 | 243 | printf("Heure server: %" PRIu32 "\n",data.heure_actuelle); |
247 | 244 | if (sock_udp_send(&sock,&data,sizeof(data), &remote) < 0) | ... | ... |