Convert TTL2Seconds to sh

Removes two external calls. This code is much faster, and the
performance improvements mean that there is no need for $stay_time to be
cached.

Also, modified one test case. IMO, a TTL of '' (though invalid) should be 0, as it is
indeed "nothing."