From the perspective of a photon, there is no such thing as time. It's emitted, and might exist for hundreds of trillions of years, but for the photon, there's zero time elapsed between when it's emitted and when it's absorbed again. It doesn't experience distance either.
Something about this doesn't make sense. This means that, from its own perspective, every photon is emitted at time T at location x, then absorbed at time T at location y, meaning there is no time "in between" those... yet somehow, at a distinct point in between those events, an object can get in the way and block the photon from reaching point y. Meaning you have two points in time that have the same value but aren'…
There is no universal time T in space time. Time is relative to the observer.
I suggest reading https://en.wikipedia.org/wiki/Minkowski_space for the mathematics.