# Transport

Industry: Transport

Transport is the part of moving goods or people that road, rail, sea and air share: a leg with a departure and an arrival, time spent waiting at a stop, a cut-off before a departure, a schedule, and how late counts as late. This layer works the same for every mode, and every time it handles is an exact instant shown in the zone where it is read.

## What these functions solve

- **Elapsed time is neither a difference between two wall clocks nor a count of the days something sat.** A leg that crosses a clock change lands at a different local time than the hours suggest. [`transitTime`](/gmt/reference/transport/calculate/transitTime/) adds the duration to the departure, and [`etaAtZone`](/gmt/reference/transport/convert/etaAtZone/) shows the arrival in the reader's zone. Days are counted midnight to midnight where the thing sat, and [`dwellTime`](/gmt/reference/transport/calculate/dwellTime/) returns the elapsed time and the local calendar days together. See [guide](/gmt/guides/industries/transport-legs-and-dwell/), [Dwell Ledger](/gmt/tools/dwell-ledger/), [scenario](/gmt/scenarios/transit-across-dst/), [scenario](/gmt/scenarios/container-dwell-days/), [mistakes](/gmt/mistakes/transport/).
- **A move with several legs needs each hand-off in the zone where it happens.** [`scheduleDelivery`](/gmt/reference/transport/calculate/scheduleDelivery/) chains the legs into one ETA. [`crossingTime`](/gmt/reference/transport/calculate/crossingTime/) times a crossing on the clock of the place that administers it, and [`nextDeparture`](/gmt/reference/transport/calculate/nextDeparture/) finds the first departure a connection can still make. See [guide](/gmt/guides/industries/transport-multi-leg-scheduling/), [Delivery Scheduler](/gmt/tools/delivery-scheduler/), [Departure Board](/gmt/tools/departure-board/).
- **A cut-off is enforced on the clock of the place that enforces it.** It is stated as a time before an event. [`cutoffAt`](/gmt/reference/transport/calculate/cutoffAt/) finds one, [`cutoffSchedule`](/gmt/reference/transport/calculate/cutoffSchedule/) finds the whole stack for a sailing, and [`isPastCutoff`](/gmt/reference/transport/compare/isPastCutoff/) and [`timeToCutoff`](/gmt/reference/transport/compare/timeToCutoff/) test a time against it. See [guide](/gmt/guides/industries/transport-legs-and-dwell/), [Cut-off Stack](/gmt/tools/cutoff-stack/), [Cut-off Ruler](/gmt/tools/cutoff-ruler/).
- **On time means nothing until you state how much slack counts.** An estimate shown as if it were an actual hides a slip. [`classifyPunctuality`](/gmt/reference/transport/compare/classifyPunctuality/), [`scheduleDeviation`](/gmt/reference/transport/compare/scheduleDeviation/) and [`punctualityRate`](/gmt/reference/transport/calculate/punctualityRate/) take the tolerance from you, and [`bestAvailable`](/gmt/reference/transport/calculate/bestAvailable/) says which class of timestamp it picked. See [guide](/gmt/guides/industries/transport-punctuality-and-timestamps/), [Punctuality Board](/gmt/tools/punctuality-board/), [scenario](/gmt/scenarios/estimate-shown-as-actual/).
- **A crew's hours of work do not follow the calendar.** A driver's or an operator's day starts at the time the operator names, and a rest is counted across any stretch of the log. [`dutyDayFor`](/gmt/reference/workforce/calculate/dutyDayFor/) returns the operator's day for an instant, and [`evaluateDutyLog`](/gmt/reference/workforce/calculate/evaluateDutyLog/) checks a duty log against the limits you state. These come from the Workforce layer. See [guide](/gmt/guides/industries/workforce-hours-of-work/), [scenario](/gmt/scenarios/duty-day-is-not-midnight/), [scenario](/gmt/scenarios/paired-rest-that-does-not-qualify/).

Start with the guide: [Transport: Legs and Dwell](/gmt/guides/industries/transport-legs-and-dwell/).

## Its own functions

### [`transport`](/gmt/reference/transport/)

**[calculate](/gmt/reference/transport/calculate/)**

- [`bestAvailable`](/gmt/reference/transport/calculate/bestAvailable/): Pick the best available timestamp for an event from its planned, estimated, requested and actual records, and say which class it is.
- [`crossingTime`](/gmt/reference/transport/calculate/crossingTime/): Measure a crossing — a canal transit, a strait passage, a border queue — and render both ends in the zone the crossing is administered in.
- [`cutoffAt`](/gmt/reference/transport/calculate/cutoffAt/): Find a deadline stated as an offset before an anchor event, in the local time of the place that enforces it.
- [`cutoffSchedule`](/gmt/reference/transport/calculate/cutoffSchedule/): Compute a whole stack of cut-offs against one anchor event, earliest first.
- [`dwellTime`](/gmt/reference/transport/calculate/dwellTime/): Measure how long something sat somewhere, and how many local calendar days it sat there.
- [`estimateDrift`](/gmt/reference/transport/calculate/estimateDrift/): Measure how far an estimate moved between its first and last revision.
- [`nextDeparture`](/gmt/reference/transport/calculate/nextDeparture/): Find the next departure a connection can make: the first scheduled departure at or after `after` plus the minimum connection time.
- [`punctualityRate`](/gmt/reference/transport/calculate/punctualityRate/): The share of planned/actual pairs that were on time under one tolerance.
- [`scheduleDelivery`](/gmt/reference/transport/calculate/scheduleDelivery/): Chain the legs of a multi-modal move into an end-to-end ETA with zone-local times at every handoff.
- [`transitTime`](/gmt/reference/transport/calculate/transitTime/): Add a transit duration to a departure and return the arrival, in the departure's own zone.

**[compare](/gmt/reference/transport/compare/)**

- [`classifyPunctuality`](/gmt/reference/transport/compare/classifyPunctuality/): Classify an arrival as early, on time or late against the caller's tolerance.
- [`isPastCutoff`](/gmt/reference/transport/compare/isPastCutoff/): Report whether a cut-off has passed.
- [`scheduleDeviation`](/gmt/reference/transport/compare/scheduleDeviation/): Measure how far an actual time is from its plan: positive when late, negative when early.
- [`timeToCutoff`](/gmt/reference/transport/compare/timeToCutoff/): Measure the time left until a cut-off, negative once it has passed.

**[convert](/gmt/reference/transport/convert/)**

- [`etaAtZone`](/gmt/reference/transport/convert/etaAtZone/): Render an arrival instant as local time in the zone where it will be read.

## Functions it draws on

### [`workforce`](/gmt/reference/workforce/)

Part of the [Workforce](/gmt/industries/workforce/) industry layer.

**[calculate](/gmt/reference/workforce/calculate/)**

- [`dutyDayFor`](/gmt/reference/workforce/calculate/dutyDayFor/): Return the operator-designated day an instant falls in: from the most recent `dayStartTime` in `timeZone` at or before the instant, up to (not including) the next one.
- [`dutyTotals`](/gmt/reference/workforce/calculate/dutyTotals/): Return the time a duty log spends in any of `statuses` inside a window, as an exact ISO 8601 duration.
- [`dutyViolations`](/gmt/reference/workforce/calculate/dutyViolations/): Return every violation of a set of hours-of-work rules inside a range, each with the window that failed it: the record over a month, not the check before dispatch.
- [`evaluateDutyLog`](/gmt/reference/workforce/calculate/evaluateDutyLog/): Evaluate every hours-of-work rule over a duty log at one instant, and report each one whether or not it binds.
- [`longestRun`](/gmt/reference/workforce/calculate/longestRun/): Return the longest unbroken stretch a duty log spends in any of `statuses` inside a window.
- [`qualifyingRestPairs`](/gmt/reference/workforce/calculate/qualifyingRestPairs/): Return every paired rest in a duty log: two separate rests that together count as one, because they meet all three floors of `spec.pair`.
- [`qualifyingRests`](/gmt/reference/workforce/calculate/qualifyingRests/): Return every rest of at least `minimum` in a duty log: the runs of touching entries in any of `spec.statuses` that last that long.

**[validate](/gmt/reference/workforce/validate/)**

- [`isValidDutyLog`](/gmt/reference/workforce/validate/isValidDutyLog/): Validate whether a value is a duty log every `workforce/` function accepts.

## Guides

- [Transport: Legs and Dwell](/gmt/guides/industries/transport-legs-and-dwell/): transitTime, etaAtZone and dwellTime — the three operations every transport mode shares, with exact elapsed legs, arrivals rendered where they land, and dwell counted in local calendar days — and cutoffAt, cutoffSchedule, isPastCutoff and timeToCutoff for deadlines counted back from an anchor event.
- [Transport: Multi-leg Scheduling](/gmt/guides/industries/transport-multi-leg-scheduling/): scheduleDelivery and crossingTime — 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.
- [Transport: Punctuality and Timestamps](/gmt/guides/industries/transport-punctuality-and-timestamps/): scheduleDeviation, classifyPunctuality, punctualityRate, bestAvailable, estimateDrift and nextDeparture — late as exact elapsed time, on time against a tolerance you state, which of four timestamp classes to show, how far an estimate moved, and the next departure a connection can make.

## Tools

- [Connection Checker](/gmt/tools/connection-checker/): Will the cargo make its onward departure? scheduleDelivery checks a scheduled connection against the arrival plus the handling time. A departure exactly at that time is made. Beside it is the wall-clock check, which can say made when the connection is missed.
- [Crossing Clock](/gmt/tools/crossing-clock/): Time a canal, strait or border crossing with crossingTime. It gives the exact elapsed hours and shows the entry and exit on the clock of whoever runs the crossing, beside the wall-clock subtraction that is an hour off on a DST night.
- [Cut-off Countdown](/gmt/tools/cutoff-countdown/): Am I late, and by how much? isPastCutoff and timeToCutoff compare a cut-off with your clock or a time you drag. They give the time left, or a negative duration once the cut-off has passed. At the cut-off itself, it has already passed.
- [Cut-off Ruler](/gmt/tools/cutoff-ruler/): Is two days before the same as 48 hours before? cutoffAt reads one departure's "two days before" three ways, as calendar days, as exact hours and as a pinned local time. All three sit on one axis, with the clock change between them marked.
- [Cut-off Stack](/gmt/tools/cutoff-stack/): When does each deadline before a sailing close? cutoffSchedule computes every cut-off against one departure and lists them earliest first. A cut-off that lands on a weekend or holiday moves to an open day the way you say; there is no default.
- [Delivery Scheduler](/gmt/tools/delivery-scheduler/): Chain truck, ship and rail legs into one ETA with scheduleDelivery: every handoff an exact instant, each arrival shown where it lands, and a missed connection shown as the null it is.
- [Departure Board](/gmt/tools/departure-board/): Which departure can you make? nextDeparture reads a list of departures, or a service that runs every N minutes, and finds the first one at or after your arrival plus the minimum connection. The end of the service window is not a departure. You can send the answer on to the Delivery Scheduler.
- [Dwell Ledger](/gmt/tools/dwell-ledger/): Drag a gate-in and a gate-out across a zone's real local-day grid and watch dwellTime count the elapsed hours and the local calendar days the dwell touched.
- [ETA Drift Chart](/gmt/tools/eta-drift/): Which timestamp do you show, and how far did the estimate move? bestAvailable picks from planned, estimated, requested and actual records and says which class it is; estimateDrift measures the slide against a tolerance you drag.
- [Punctuality Board](/gmt/tools/punctuality-board/): Was it late, by how much, and what share was on time? scheduleDeviation, classifyPunctuality and punctualityRate judge a set of arrivals against a tolerance you drag. An arrival exactly on the limit counts as late, an early limit is optional, and there is no default tolerance.
- [Timetable Reader](/gmt/tools/timetable-reader/): Read a timetable's printed local times as exact instants with scheduleDelivery's startTimeZone. A repeated time is read as the earlier of its two instants and a skipped time as the later one. An offset written beside a repeated time says which of the two is meant.

## Scenarios

- [A 26-Hour Rail Leg Across Spring-Forward](/gmt/scenarios/transit-across-dst/): A train leaves at 20:00 the evening before clocks spring forward and runs for 26 hours. Adding to the wall clock puts it in a station an hour before it arrives.
- [A Connection Missed at the Spring-Forward Handoff](/gmt/scenarios/connection-missed-at-spring-forward/): A truck reaches the London port the morning clocks spring forward. An offset table says the ship connection holds with 30 minutes to spare. It is missed by 30 minutes.
- [A Delay Across the Fall-Back](/gmt/scenarios/delay-across-fall-back/): A train due at 02:30 on the night Sydney's clocks go back arrives at 02:30 by the station clock, an hour later. Subtracting the clocks says it was on time.
- [A Filing Deadline Anchored to the Wrong Event](/gmt/scenarios/filing-anchored-to-the-wrong-event/): A rule says 24 hours before loading. The system counts 24 hours before departure, which is two and a half days later, and every filing it schedules is late.
- [An Estimate Shown as the Actual](/gmt/scenarios/estimate-shown-as-actual/): A vessel berthed at 12:52. An hour later a late feed delivered an estimate of 13:05, and the dashboard's Actual column now says 13:05.
- [Container Dwell: Two Hours, Two Days](/gmt/scenarios/container-dwell-days/): A container gates in at 23:00 and out at 01:00. The terminal charges two days, and dividing hours by 24 says one.
- [Two Arrivals, One Wall Time: The Fall-Back Night](/gmt/scenarios/arrival-on-a-fall-back-night/): Two flights land in London an hour apart on the night clocks fall back, and the arrivals board shows 01:30 for both.
- [Two Days Before Is Not 48 Hours](/gmt/scenarios/two-days-before-is-not-48-hours/): A documentation cut-off is 17:00 local two days before the vessel sails. Subtracting 48 hours from the departure puts it an hour late, and a DST weekend moves it again.

## Mistakes

- [Transport](/gmt/mistakes/transport/): Common mistakes with transit legs, arrivals, dwell, connections, cut-offs, punctuality, timestamp classes and next departures in GMT's transport layer.
