Currently, the way 2FA works is that the current 30 second window is checked. Often times, 2FA will give a code that is 20 or more seconds into the 30 second window, giving people 10 or less seconds to type the code.
You can either choose to wait, or try and rush it and hope that the login process all succeeds within 5 seconds.
The way that most login portals handle TOTP tokens is to do a rolling window, that checks either the previous and current, or current and next. This removes the chance for system time differences, user input delays, etc.