Torture And The Law
There's no need to legalize torture to forestall the ticking time bomb scenario.
We have understood for a century and a half that there may be times when you cannot obey the law. If someone is going to blow up Los Angeles and you can stop them, but only by breaking the rules: well, break the rules. And accept that there might be consequences for breaking the law. You might be convicted. You might go to jail. But you'd go to jail knowing that you saved Los Angeles, which is probably a better thing than lounging about in Philadelphia with the knowledge that you could have saved Los Angeles, but didn't.
In practice, judges and juries are understanding. But actions have consequences; adults understand and accept that. This government, unfortunately, doesn't.