If we imagine that clock is rotated 90 degrees from the textbook example, and now the clock light travels back and forth on the same axis that object is moving. For a stationary clock, time needed for a photon to go from one mirror and back would be:
τ(stat)=2*d0/c
For a moving clock and a stationary observer, we first know that photon must go over distance d, increased by the distance that mirror 2 has traveled:
c*t1 = d + v*t1
Notice that we're assuming that distances d are not equal for both cases. Then it must go back, but this time the distance it has to go will be reduced by the amount that mirror 1 travels in it's direction:
c*t2 = d - v*t2
Total amount of time needed for photon to go from mirror 1 to mirror 2 and back would be:
τ(mov)= t1 + t2
= d/(c-v) + d/(c+v)
=2cd/(c^2 - v^2)
Now, the distance d here is not the same as distance d0 that we have in the first equation, because we have the effect of length contraction. Motion distance will be:
d=d0/γ
d=τ(stat)*c/(2*γ)
Where we know:
γ^2= c^2/(c^2 - v^2)
If we replace that in our equation, we get:
τ(mov)= [2*c*d]/(c^2 - v^2)
= [2*c*τ(stat)*c/(2*γ)]/(c^2 - v^2)
= τ(stat)*c^2/[γ*(c^2 - v^2)]
= τ(stat)*γ^2/γ
= τ(stat)*γ
This should be a time dilation formula for longitudinal light clock.