“In time” is about being somewhere or doing something at the right moment, but with a little bit of time to spare. Imagine a situation: your class starts at 8:30, and you arrive at school not exactly at the bell, but a little earlier, say, at 8:25. This means that you are on time, because you are not late, but you are not exactly on time either. Another example - you're handing in a test, and you have a couple minutes to check everything and take a break. This is also in time, because you didn't do everything at the last moment, but left yourself a little more time.
Basically, in time can be used when you have time to do something before a certain moment or when there is a good time to act. For example, you got sick, but you took the medicine in time - in time so that it wouldn't get worse. Or you caught the ball in time - just before it hit the ground. It's not just about meeting deadlines, it's about catching the right moment and acting ahead of time, not in time.
So if you want to say that you were ahead of somewhere or did something with time to spare, use in time!