optimize all td algorithm to work with dynamic interval time