The TT itself - that is, the x lap average time you end up with - is one thing, gaining SR is another.
In order to get a TT result, you need to complete the specified number of laps; you can either quit and withdraw if you're happy with your time (in terms of TT champ position/ttrating etc), or you can continue and try to improve it.
The SR counts each time you take a corner in any official non-practice session, so in order to gain SR in a TT, join a session and pound around until it ends. Note that in these sessions you're only getting SR at a 0.35 multiplier compared to a race, so while it's useful for getting from e.g. 3.98 to >4, you're better off simply doing clean races. Inevitably that doesn't always happen that smoothly, but if you're a safe enough driver you'll cancel out the dips along the way naturally.
One other thing to bear in mind is that when you're the only one in a TT and you withdraw, that session closes on the server, committing your result. If you're not the only one in there, you'll have to wait for the other person to quit as well before you can see your result and new SR.