Commonly, an infinitive is used with the subject it. The sentence structure is "It is + infinitive.…" It refers to the infinitive. This expression is used in many ways.Example :
1. It is time to do math.
2. It was nice to see you.
3. It is good to see you.
Both gerunds and infinitive phrases can function as nouns, in a variety of ways. Gerunds and infinitives can follow certain verbs but not others.