Screen your route against the visa-free transit criteria and find official rules.
For the 240-hour route, count from midnight at the start of the day after entry. Check the official rules for your connection.