Earth turns through 360 degrees in about 24 hours. That makes an hour of time difference equivalent to 15 degrees of longitude. Compare local noon with the time at a reference meridian and the difference tells you how far east or west you are.
The arithmetic was the easy part for sailors. Carrying accurate reference time on a moving ship was the engineering challenge. A marine timekeeper made a piece of geography portable.