# Industries

Industry: Workforce, Transport, Intermodal, GNSS, Maritime, Finance, Healthcare, Aviation, Rail, IoT

The core of GMT is a set of general primitives: zoned arithmetic, real day boundaries,
half-open intervals, business calendars. Each industry layer is a small set of functions
that name the operation an industry actually performs, built on those primitives so every
layer agrees about what a midnight, a day or an elapsed hour is.

Each industry also has an overview page under [By industry](/gmt/industries/).

Three things hold across every industry layer:

- **Facts come from the caller.** A port, airport, terminal or station code is not resolved
  to a time zone, and a contract term is not looked up by carrier. You pass the IANA zone and
  the terms; GMT does the time arithmetic. That keeps the library free of registries that go
  stale.
- **Elapsed time and calendar days are different answers.** A leg is elapsed hours across
  whatever DST transition it crosses. A charge is counted in local calendar days at the place
  the thing sat. The industry functions return both where both matter, and never derive one
  from the other.
- **Every result is a standard string.** The same ISO 8601 and RFC 9557 strings as the rest of
  the library, so an industry result feeds straight back into `interval/`, `zoned/` or a
  business calendar.

## Layers

- [Workforce: hours of work](./workforce-hours-of-work/) — read a duty log against the limits you
  state: the operator's day, sliding and fixed windows, split rests and quotas. Shared by any
  crew, shift or rota; Transport draws on it.
- [GNSS: system time and week rollover](./gnss-system-time-and-week-rollover/) — read each
  satellite system's clock against UTC, name the week counter and the rollover era, and turn a
  RINEX navigation week into a date. Draws on the leap-second table.
- [Maritime: GNSS time and week rollover](./maritime-gnss-time-and-week-rollover/) — which systems
  a ship may use, why the log keeps UTC, how long a receiver's week counter stays right over a
  ship's service life, and a leap second in a ship's record.
- [Transport: legs and dwell](./transport-legs-and-dwell/) — add a leg's transit time to a
  departure, show an arrival where it lands, and measure dwell in exact hours and local
  calendar days. Shared by road, rail, sea and air. Its
  [deadlines from an anchor](./transport-legs-and-dwell/#deadlines-from-an-anchor) find a
  cut-off counted back from a departure, a loading or an arrival, pinned to a local time of day
  and rolled off closures, and tell you whether it has passed.
- [Transport: multi-leg scheduling](./transport-multi-leg-scheduling/) — chain truck, ship
  and rail legs into one ETA with every handoff an exact instant, check a scheduled connection
  against the minimum connect time, and time a crossing on the clock that administers it.
  Built on the legs-and-dwell layer.
- [Transport: punctuality and timestamps](./transport-punctuality-and-timestamps/) — measure how
  late an arrival was in exact time, judge it against a tolerance you state, count a rate, pick
  the best of planned, estimated, requested and actual timestamps, measure how far an estimate
  moved, and find the next departure a connection can make. Built on the legs-and-dwell layer.
- [Intermodal: free time and demurrage](./intermodal-free-time-and-demurrage/) — which clock a
  charge runs on, which day is free day one, calendar or working days, and the chargeable days
  and dates behind every count. Built on the transport layer's day count.
- [Intermodal: billing deadlines](./intermodal-billing-deadlines/) — the last date to issue,
  dispute and resolve a demurrage or detention invoice, counted in calendar days from a date you
  name, with every window a number you pass. Built on the free-time layer's charged dates.
- [Intermodal: B/L dates and multimodal ETA](./intermodal-bill-of-lading-and-eta/) — a bill of
  lading's issue, receipt and shipped-on-board dates on the local calendar of the place each
  happened, and an end-to-end ETA with transit and dwell reported apart. Built on the multi-leg
  scheduling layer.
- [Intermodal: EDI timestamps](./intermodal-edi-timestamps/) — read and write the dates and
  times in UN/EDIFACT `DTM` segments, X12 elements and EPCIS events, and know for each one
  whether its offset is stated. An offsetless value stays a local time until you name the zone.
- [Finance: message timestamps](./finance-message-timestamps/) — read and write a FIX
  `UTCTimestamp` at the precision its digits state, cut rather than rounded when narrowed, with a
  second of sixty accepted only for a leap second UTC really inserted. Draws on the leap-second
  table.
- [Healthcare: clinical timestamps](./healthcare-clinical-timestamps/) — read and write HL7
  version 2 dates and times, keep a time with no offset local until you name the sender's zone,
  and keep a partial date a span.
- [Aviation: message times](./aviation-message-times/) — read, write and check an SSIM schedule
  date such as `01JAN26`, with month letters that ignore the platform's language and a century
  you state. Read a METAR time such as `251200Z` against the time it was received, and a NOTAM
  validity with its `EST` and `PERM`. Draws on Core only.
- [Rail: GTFS service days](./rail-gtfs-service-days/) — read, write and check a GTFS stop time
  such as `25:35:00`, which runs past midnight and stays with its service day. Draws on Transport.
- [IoT: PTP time](./iot-ptp-time/) — convert a Precision Time Protocol timestamp, which counts TAI,
  to UTC with the offset the grandmaster announces, and check that offset against the leap-second
  table. Draws on Core only.

## Scenarios

Each layer comes with real-world scenarios that show the naive approach breaking beside the
GMT approach working, on the same live widget:

- [Container dwell: two hours, two days](/gmt/scenarios/container-dwell-days/)
- [A 26-hour rail leg across spring-forward](/gmt/scenarios/transit-across-dst/)
- [Two arrivals, one wall time: the fall-back night](/gmt/scenarios/arrival-on-a-fall-back-night/)
- [A Connection Missed at the Spring-Forward Handoff](/gmt/scenarios/connection-missed-at-spring-forward/)
- [Two Days Before Is Not 48 Hours](/gmt/scenarios/two-days-before-is-not-48-hours/)
- [A Filing Deadline Anchored to the Wrong Event](/gmt/scenarios/filing-anchored-to-the-wrong-event/)
- [An Estimate Shown as the Actual](/gmt/scenarios/estimate-shown-as-actual/)
- [A Delay Across the Fall-Back](/gmt/scenarios/delay-across-fall-back/)
- [Free time: which day is day one](/gmt/scenarios/free-time-start-day/)
- [Demurrage across a weekend](/gmt/scenarios/demurrage-across-a-weekend/)
- [Detention is not demurrage](/gmt/scenarios/detention-is-not-demurrage/)
- [Invoice a Day Late](/gmt/scenarios/invoice-a-day-late/)
- [A Re-Bill Anchored on the Wrong Date](/gmt/scenarios/re-bill-anchored-on-the-wrong-date/)
- [A Dispute Window from a Contract](/gmt/scenarios/dispute-window-from-a-contract/)
- [A B/L Dated a Day Late](/gmt/scenarios/bill-of-lading-dated-a-day-late/)
- [An ETA That Forgot the Sailing](/gmt/scenarios/eta-that-forgot-the-sailing/)
- [A 203 Read as UTC](/gmt/scenarios/a-203-read-as-utc/)
- [ET Is Not an Offset](/gmt/scenarios/et-is-not-an-offset/)
- [The EPCIS Offset Nobody Kept](/gmt/scenarios/the-epcis-offset-nobody-kept/)
- [A Millisecond Stamp Read as Nanoseconds](/gmt/scenarios/a-millisecond-stamp-read-as-nanoseconds/)
- [Second Sixty on an Ordinary Day](/gmt/scenarios/second-sixty-on-an-ordinary-day/)
- [An HL7 Time Read as UTC](/gmt/scenarios/an-hl7-time-read-as-utc/)
- [A TS Date Read as a Time](/gmt/scenarios/a-ts-date-read-as-a-time/)
- [A FHIR Month Padded to Midnight](/gmt/scenarios/a-fhir-month-padded-to-midnight/)
- [An SSIM Month Read in the Wrong Language](/gmt/scenarios/an-ssim-month-read-in-the-wrong-language/)
- [A METAR from Last Month](/gmt/scenarios/a-metar-from-last-month/)
- [PERM Read as a Date](/gmt/scenarios/perm-read-as-a-date/)
- [A GTFS Time Folded into One Day](/gmt/scenarios/a-gtfs-time-folded-into-one-day/)
- [A PTP Stamp 37 Seconds Ahead](/gmt/scenarios/a-ptp-stamp-37-seconds-ahead/)

The mistakes that have hurt people in these layers are collected under
[Transport mistakes](/gmt/mistakes/transport/), [Intermodal mistakes](/gmt/mistakes/intermodal/),
[Finance mistakes](/gmt/mistakes/finance/), [Healthcare mistakes](/gmt/mistakes/healthcare/),
[Aviation mistakes](/gmt/mistakes/aviation/), [Rail mistakes](/gmt/mistakes/rail/) and [IoT mistakes](/gmt/mistakes/iot/).
