Which is grammatically correct? I can only do so much in this time. Or i can do only so much in this time.

It was only when is by comparision more 'relaxed' writing, more like someone is recounting something to someone. The oxford english dictionary defines but only (which can also occur as only but) as meaning Γ’β‚¬Λœ (a) only, merely; (b) except onlyÒ€ℒ, and comments that its use is now poetical.