Yes, the timer does pause in menus, as well as trainer battles and cut scenes. It doesn’t pause during wild Pokemon battles.
I just tested it. The day cycle is normally 16 minutes and night is 8 mins. I’d already been doing stuff in the daytime for a little while, then went into the menu for around 15 minutes, then after exiting the menu it was another 5 minutes until I got the message about the sun setting. And another few minutes until it became night. In total over 30 minutes.
Also to add, a short way into the game (mission 8), after you battle Lida you gain the ability to sit on benches. With this you can “kill some time” until night or day. So there’s not really any need to optimise, you can skip to whichever you want at that moment.