Not exactly. Since it's possible in the editor to put a key at the exact end of the timeline (at the length), the actual length of the animation and the one you should be modding with should be length + 1. (Or it would be more intelligent to prevent having timeline key with their time = length of the animation)
If I have an animation of length 120 and I can place a timeline key at 0 and at 120, I have in fact 121 possibilities to place my timeline key. Also, If the newtime is 120 (exactly on a timeline key) and I mod it by 120, it will become 0 meaning the last timeline key will be completly skipped.
Example (with 5 of length and 6 frames):