tstools: check for wrap arounds in length calculation