Time Zones for Maritime Data Analysts

Jordan Taylor
Shipping Intel
Published in
5 min readSep 16, 2023

In vessel operations, time can be a deceptively complex subject. In the following article we look at concepts such as local time (LT) and universal time coordinated (UTC) and how to express these concepts programmatically and using OpenAI’s GPT 4.0.

Source: DALL-E

Introduction

There are two fundamental types of time in ocean shipping. One is universal coordinated time (UTC) and the other is local time (LT). It is, in practice, easy enough to conflate the two concepts. This is especially true when working with large amounts of data or obtaining sensor or application program interface (API) data that may not contain a descriptor attached to a date and time.

At sea local time (LT) is set to the nearest longitudinal meridian divisible by 15°. Therefore, the time zone extending 7.5° on each side of the meridian is usually the same, and differs by one hour. The number of zones that extend east or west from the international reference meridian can be applied to local time (LT) to obtain universal time coordinated (UTC), and vice versa.

Delineation of time zones on land began in 1883 during the propagation of the railroad (Bowditch, 1975). Time zones on land — and in port areas — are altered somewhat for convenience. Today, time zones can be sourced for free from the Internet Assigned Numbers Authority (Apple, 2023). In practice, vessel crews may consult with local agents prior to distribution of estimated time of arrival (ETA) to owners and charterers.

Method

The file tzdb-2023c.tar.lz, which contains up-to-date time zones, can be downloaded for free from the Internet Assigned Numbers Authority (IANA).

The package may be unpacked using a bash command.

tar --lzip -xvf filename.tar.lz

For convenience, the Python package pytz (Bishop, 2023) can be used for handling time zones.

pip install pytz

Three examples of handling time zones will be demonstrated. One is obtaining an estimated time of arrival in local time (LT), application of daylight savings (DST), and obtaining local time using a reference meridian.

Example #1: Obtaining Estimated Time of Arrival in Local Time

A vessel’s automated information system (AIS)-derived longitude is 141° 18.4’ W. The vessel is enroute to Singapore. The vessel’s AIS-derived time is 15:18 UTC on November 28th, 2023. Using Searoute, we calculate the time remaining for arrival to Singapore is 21 days and 23 hours using an economical speed of 12.5 knots.

What will be the estimated local time of arrival in Singapore?

Step 1: Verification of Vessel’s Time

We can quickly verify that the vessel’s reported time is indeed in universal coordinated time and not in local time. For example, our local time in San Francisco — obtained at the same time as the AIS ping — is 08:18 (UTC-7).

Calculation: 08:18 LT + 7 (reverse the sign when converting from local time to universal coordinated time) = 15:18 UTC.

With this check we determine that the vessel’s time is rendered in universal time coordinated and not in local time.

Step 2: Application of Time to Go

We will add 21 days and 23 hours to 15:18 UTC on November 28th, 2023.

initial_time = datetime(2023, 11, 28, 15, 18)
add_time = timedelta(days=21, hours=23)

new_time = initial_time + add_time

The estimated arrival time in Singapore is 14:18 UTC on December 19th, 2023.

Step 3: Convert UTC Time in Singapore to Local Time

from datetime import datetime, timedelta
import pytz

utc_time = datetime(2023, 12, 19, 14, 18, tzinfo=pytz.utc)
singapore_tz = pytz.timezone('Asia/Singapore')

local_time_singapore = utc_time.astimezone(singapore_tz)

The estimated arrival time in Singapore is 22:18 LT on December 19th, 2023.

Alternative: GPT 4.0

A natural language input of the above example (“A vessel’s…in Singapore?”) in GPT 4.0 will result in an arrival time of 21:18 LT on December 19th, 2023. GPT 4.0’s outcome matches the programmatic outcome using steps one through three.

Example #2: Daylight Savings Time (DST)

What is the date and time in Tokyo, Japan if the local time in New York is 16:00 on October 5th, 2023?

Step #1: Establish if Daylight Savings Applies

In some parts of the world time is advanced during the summer to provide greater use of daylight.

from datetime import datetime, timedelta
import pytz

def daylight_savings(timezone_str, check_date):
tz = pytz.timezone(timezone_str)
dt = datetime(check_date.year, check_date.month, check_date.day)
dt = tz.localize(dt)
return dt.dst() != timedelta(0)

check_date = datetime(2023, 10, 5)
daylight_savings = daylight_savings('America/New_York', check_date)

In the example above we find that New York is experiencing daylight savings.

Step #2: Apply Daylight Savings

Since DST applies we advance time one hour and convert to UTC. If we advance 16:00 LT one hour then UTC will be 20:00.

Calculation: 16:00 LT + 4 (the time zone during times other than DST is +5 and the sign is reversed when converting to UTC) = 20:00 UTC.

Step #3: Obtain Local Time in Japan

Japan does not observe daylight savings and the time zone is UTC +9.

from datetime import datetime, timedelta
import pytz

utc_time = datetime(2023, 10, 5, 20, 0, tzinfo=pytz.utc)
tokyo_tz = pytz.timezone('Asia/Tokyo')
local_time_tokyo = utc_time.astimezone(tokyo_tz)

The local time in Tokyo will be 05:00 on October 6th, 2023.

Alternative: GPT 4.0

GPT 4.0 will produce the same answer as above using the natural language query “What is the date…October 5th, 2023?”.

Example #3: Local Time using a Meridian

A vessel is underway at an AIS-derived longitude of 137° 30’ W. The current local time in New York is 12:00 on the 5th of December. What is the local time on the vessel?

Step #1: Find the Nearest Meridian

Dividing 137° 30’ W by 15° results in 9.2, or UTC -9.

Step #2: Find the UTC Time for New York

New York is UTC -5. Daylight savings does not apply. Therefore, the UTC time for 12:00 LT is 17:00 UTC.

Step #3: Apply Time Zone for Nearest Meridian to Universal Time Coordinated

Convert 17:00 UTC to the vessel’s local time by applying UTC -9.

Calculation: 17:00 UTC -9 = 08:00 LT. This intuitively makes sense as the vessel is plying somewhere off of the U.S. West Coast.

Alternative: GPT 4.0

As of this writing GPT did not produce the correct answer, though the outcome was admittedly close. GPT assumed that degrees and minutes of longitude would represent a fractionalized time zone rather than a whole number.

Conclusion

Three examples of handling time zones are demonstrated.

This first is a method of obtaining an estimated time of arrival in local time. A programmatic solution using Python and a successful outcome using GPT 4.0 is demonstrated. The second example is application of daylight savings programmatically and using GPT 4.0. Finally, local time at the vessel is obtained using traditional techniques in marine navigation. In this case GPT is unable to produce the correct answer.

Correct handling of time is critical to voyage management systems, just in time arrivals, use of AIS-derived time, and many other use cases. Miscalculation of time in almost all cases within marine operations could incur real-world cost.

References

(n.d.). Procedures for Maintaining the Time Zone Database. Retrieved September 16, 2023, from https://www.iana.org/time-zones

Bishop, S. (n.d.). pytz · PyPI. PyPI. Retrieved September 16, 2023, from https://pypi.org/project/pytz/

Bowditch. (1975). Americal Practical Navigator.

GPT-4. (2023, March 14). OpenAI. Retrieved September 16, 2023, from https://openai.com/research/gpt-4

Sources for Time Zone and Daylight Saving Time Data. (n.d.). Apple Open Source. Retrieved September 16, 2023, from https://opensource.apple.com/source/system_cmds/system_cmds-671.10.3/zic.tproj/tz-link.htm

--

--

Jordan Taylor
Shipping Intel

Merchant marine officer with a B.S. in Marine Transportation and a M.S. in Transportation Management.