The time of tapping in at the ticket barriers counts for the whole trip. If you get in just before the start of peak-hours, you still pay the off-peak rate for the whole trip. But if you tap in before 9am, the whole trip counts as peak-rates also the part that happens after 9am.
Transfer don't change it, they're all part of the same trip. Going out of a station and then back in also doesn't interrupt your trip. As far as I know you need 60 minutes of being "out" of the train system for it to be considered a new trip.