NTP Client that measure times between Server (written in C)
This project needs to be written in C and fully functional code that will run on a raspberry pi. Some project details are included below, but more importantly the full details are included in the attachments. This MUST be coded clean and commented.
You will write an NTP client that measures the time between your Pi machine
and the network server. You will compare transit times to near and faraway
servers and measure the variation.
The basic outline includes:
1) Open a socket for UDP
2) Open the server NTP socket
3) Send the server and empty time packet except for byte 0 (that contains the constant 0x1b)
4) Recieve the time packet from the server
5) Print out the server time and the elapsed clock time from before step 3 and after step 4
It is important to get the byte ordering right. Machines can be either little-endian or big-endian. Unix provides the right macros to correct byte ordering. A useful hint of code is:
clocktime=ntohl(incoming. xmttime. int_part1) - JAN_1970;
You may find the following URLs useful: