Roth IRA Clock

Imagine 25 years ago, a person put some money into  a Roth IRA. He took the money out, along with his gains. At that time, he was under 59.5 years of age and the money was not in long enough for his Roth  IRA clock to reach 5 years.

 

Now today, he is over 60 and he puts money into a new Roth IRA (with a different broker) and then takes it out a few weeks latter including some profits. I am thinking those profits  should be tax free because he is over 59.5 and it has been more than 5 years since he first put money into a Roth  IRA. Am I  right about that?

 

Also, assuming that I am right,  how does the IRA know that he put money more than 5 years ago?