Convert TTL2Seconds to sh

Removes two external calls (grep and bc). This code is 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."

I mulled over whether TTL2Seconds should throw some error if the TTL is invalid, however, the ValidTTL function is there for a reason, and we should take care to protect TTL2Seconds with it.