Convert TTL2Seconds to pure sh

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

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