a function-definition is not allowed here before '{' token

The problem is definitely with line 72

  unsigned long sendNTPpacket(IPAddress & address)

I don't see any indication that it's due to unclosed brackets; both a manual examination and CTRL + F found the same number of each type of bracket (25).

So here's my code, repeating that this is my first time doing anything like this so it's probably hideous Frankenstein code, and I haven't finished it beyond this error (line 72). Feel free to offer any additional advice while you're in there though.