I wonder if there's a smarter way to get these 4 consecutive bytes from a buffer, concatenated in a unsigned long.
// the timestamp starts at byte 40 of the received packet and is four bytes,
// or two words, long. First, extract the two words:
unsigned long highWord = word(packetBuffer[40], packetBuffer[41]);
unsigned long lowWord = word(packetBuffer[42], packetBuffer[43]);
// combine the four bytes (two words) into a long integer
// this is NTP time (seconds since Jan 1 1900):
unsigned long secsSince1900 = highWord << 16 | lowWord;
Serial.print("Seconds since Jan 1 1900 = ");
Serial.println(secsSince1900);
Seems overkill to me, thinking these 4 bytes are already consecutive in the buffer.
Result should be unchanged i.e. having the value in a variable.