The Discarded Seconds: A Timetable Migration Where 58 of 60 Compact Durations Arrive Shorter Than They Left
The migration meeting was going well until someone added up the day. A scheduling team was moving its duration records out of a legacy export — plain...
The migration meeting was going well until someone added up the day. A scheduling team was moving its duration records out of a legacy export — plain second counts, some running to just under 24 hours — into the friendlier forms its new tool displayed: clock-style strings for the reports, decimal hours for the planning sheet, and a compact hours-and-minutes style for the summary feed. The totals for the first test day came back light. Not by much: a minute here, half a minute there, always short, never long. Nothing had been deleted and no record had failed to import. The compact form simply has no seconds field. Every duration that passed through it arrived with its seconds component — anywhere from 1 to 59 of them — quietly left behind, and 58 of the 60 test durations had seconds to lose.
What The Discarded Seconds means
The Discarded Seconds means the part of a duration that a written form cannot carry and drops by construction: not rounded, not misconverted, but absent from the spelling, so no parser, however correct, can return it. The nearest prior concept is The Five Durations. The Five Durations described one duration written in five notations — plain seconds, ISO 8601 PT form, HH:MM:SS, compact human form and decimal minutes — and every notation was lossless: the full parse matched 300 of 300. The Discarded Seconds is the set where that happy result fails. This inventory's five forms include two that destroy the value by construction. Decimal hours quantise a duration at 36 seconds per step, so only 1 of 60 rows is recovered exactly. The compact hours-and-minutes form has no seconds field at all: it discards between 1 and 59 seconds from 58 of 60 rows, always downward, never rounding, and only the 2 rows whose seconds component is exactly zero survive it whole.
1 Pre-Migration Inventory: 300 Durations, Five Ways of Being Written
The measured inventory holds 300 distinct durations in whole seconds, from 45 seconds up to 86,399 seconds — just under 24 hours — totalling 12,963,200 seconds. Before any switch, take the inventory of forms, because the migration's cost depends entirely on which forms the durations will be written in. The 300 durations are spread evenly across five written forms, 60 each: bare second counts; mm:ss; hh:mm:ss; decimal hours at two decimal places; and the compact hours-and-minutes style. Exact string matching against the bare-seconds inventory recovers only the 60 bare rows. That is the baseline — and the pre-migration inventory already separates the forms into two kinds. The two colon forms are lossless by construction: mm:ss and hh:mm:ss between them carry every component of the value. The other two converted forms are lossy by construction, one by quantisation and one by omission, and no migration procedure can repair a loss that happens at the moment of writing.
2 Switch Steps and Timing: Parse the Colon Forms First, Then Count What the Other Forms Cost
The switch procedure runs two parses, in an order that isolates the two losses. Step one, the colon parse, reads the bare counts and both colon forms and leaves decimal hours and the compact form unparsed: it recovers 180 of 300, with 0 false merges. Step two, the full parse, adds grammars for decimal hours and the compact form: it recovers 183 of 300, again with 0 false merges. The full grammar buys only 3 rows over the colon parse — the single decimal-hours row whose rounding happens to land home, and the 2 compact rows with a zero seconds component. The recovery table, with the worst loss each form can inflict, is the migration's real price list:
| Written form | Exact recovery of 60 | Worst-case seconds lost |
|---|---|---|
| Bare seconds | 60 | 0 |
| mm:ss | 60 | 0 |
| hh:mm:ss | 60 | 0 |
| Decimal hours, two decimals | 1 | Up to 18 s either way |
| Compact hours and minutes | 2 | 1–59 s, always downward |
The two lossy forms fail differently, and the difference matters for the migration plan. Decimal hours lose by quantisation: a hundredth of an hour is 36 seconds, so a decimal-hours spelling names a ladder of values 36 seconds apart, and a parsed-back value can sit up to half a step — 18 seconds — from the truth in either direction. The compact form loses by truncation: it keeps the hours and minutes and drops the seconds whole, so the error is one-directional, between 1 and 59 seconds, and it never cancels out in a total. Timing matters in one respect: both losses are created when the lossy spelling is written, not when it is parsed, so the survival count must be taken against the pre-switch export, while the true second counts still exist.
3 The Worked Duration: 55,978 Seconds, Written Five Ways
Follow one duration through the switch. Its true length is 55,978 seconds. Written as a bare count, "55978", it is exact. Written as "932:58" in mm:ss, it is exact. Written as "15:32:58" in hh:mm:ss, it is exact — all three lossless forms carry the value whole. Written as "15.55 h" in decimal hours, it parses back to 55,980 seconds: the spelling cannot name 55,978, its nearest rung is 2 seconds higher, and the migration invents 2 seconds that were never in the record. Written as "15h32m" in the compact form, it parses back to 55,920 seconds: 58 seconds discarded, the entire seconds component of the true value, with no error raised anywhere, because "15h32m" is a perfectly valid spelling of a shorter duration. One record, five spellings, and the two failures are of opposite kinds — one form adds time, the other removes it — which is why an aggregate reconciliation can look calm while individual records are wrong in both directions.
4 Parallel Run and Rollback: Keep the Second Counts Alive Until the New Forms Prove Themselves
The parallel-run arrangement follows from the asymmetry of the losses: the friendly forms can be generated from the second counts at any time, but the second counts can never be regenerated from a compact spelling that never held them. So run both inventories in parallel for one full reporting cycle, with the bare second counts as the system of record and the written forms as a display layer computed from them. During the parallel run, reconcile per record, not in aggregate: decimal-hours errors point in both directions and cancel in a sum, while compact-form errors all point downward, so a total that matches proves nothing about the records and a total that falls short is the signature of truncation, not of missing records. The rollback plan is safe exactly as long as the parallel run was honest — the second-count inventory still exists untouched — and impossible the moment a single-step switch overwrites counts with spellings. The one arrangement to refuse is letting the compact form become a storage format: a duration stored as hours and minutes has already spent its seconds, and no later migration can buy them back.
Questions on The Discarded Seconds, answered
1. Why does the full parse recover only 3 more rows than the colon parse? Because the two forms the full parse adds are lossy by construction. Of their 120 rows, decimal hours recover 1 — the one row whose value the 36-second quantisation happens to land on — and the compact form recovers 2, the rows whose seconds component is zero. The other 117 rows were damaged when their spellings were written, before any parser saw them.
2. Why do compact-form errors never cancel out in a total? Because the compact form truncates rather than rounds. It drops the seconds component whole, so every affected row loses between 1 and 59 seconds and no row ever gains. Across the 58 affected rows in the measured block, the losses all point the same way, and a migrated total inherits the full sum of them.
3. Is decimal hours at more decimal places a safe storage form? Safer, but the mechanism does not change. Each added decimal divides the 36-second step by ten, so three decimals quantise at 3.6 seconds and still cannot name most whole-second values exactly. In the measured set, two-decimal hours recovered 1 of 60; a storage form that must hold whole seconds exactly has to carry a seconds field, as both colon forms do.
Red line: never store a duration in a form with no seconds field — the compact hours-and-minutes spelling discarded seconds from 58 of 60 measured durations, always downward and never by rounding, and a total built from such spellings is short by the sum of everything it silently threw away.