The Earth makes one full 360° turn each day. If we divide this rotation into 24 hours, each hour-long division of time represents a 15° segment of longitude (east-west). Every degree of longitude gives four minutes of local time difference.
If you know the variation in local time between two places on Earth, you immediately know the longitude between them. The five-hour time difference between Greenwich and New York represents 75° of longitude.
Measuring your local time at sea is fairly easy. The difficulty lies in knowing the local time back home. There are two ways to solve this problem. One way is to carry home time with you on an accurate clock, set before ship departs. Another way is to use the sky as a clock, measuring the position of the Sun, Moon and stars to calculate both your local time and your home time.
Notes from the Greenwich Observatory, London. March 2016