Use new input transformation API in %time magic

This avoids the perils of 'multiline specials', where valid Python code unexpectedly gets turned into IPython magic commands.

Closes gh-3334