This block is a common enough pattern that it ought to be a utility method for finding the beat length (or maybe the prev/next beat) at a current position.