We currently call GetTime() 4 times in SendMessages(). Consolidate this to once GetTime() call.
This is a backport of [[https://github.com/bitcoin/bitcoin/pull/21236 | core#21236]] [1/6]
https://github.com/bitcoin/bitcoin/pull/21236/commits/c02fa47baa517e17b5c43bde3902b1e410c1b93f