For tracking a spacecraft and doing radio science, the transformation between the proper time $\tau$ given by a clock carried on board a spacecraft and the barycentric coordinate time (TCB) is investigated under IAU resolutions. In order to show more clearly physical pictures and improve computational efficiency, an analytic approach is adopted. After numerical checks, it shows this method is qualified for a Mars orbiter during one year, especially being good at describing the influence from perturbing bodies. Further analyses demonstrate that there are two main effects in the transformation: the gravitational field of the Sun and the velocity of the spacecraft in the barycentric coordinate reference system (BCRS). The whole contribution of them is at the level of a few sub-seconds.