ECSS Packet Utilisation — Relative-Time Data Type (space-systems/ecss/e7041-relative-time)
Use when the task is the relative-time data type of ECSS-E-ST-70-41C
clause 7.3.11 — the three normative items that make a duration a
different thing from a moment, even though the two are counted with the
same coarse-and-fine fields.
Domain quick reference
- A relative-time parameter carries a duration: a collection interval,
an offset from a reference time, a timeout, the gap between two
events. It is not measured from anywhere.
- It has no epoch, and that absence is the point. Applying an epoch to
a duration turns a twelve-second interval into a date twelve seconds
after the epoch, and the date looks entirely reasonable in a display.
- It is signed. An offset can point before its reference and a drift
can go the other way, so the coarse count is a two's-complement
quantity. That makes the range asymmetric: a one-octet coarse field
reaches -128 but only +127, and code that assumes a symmetric range
fails at exactly one value.
- The fine count stays non-negative whatever the sign of the duration.
The total is counted in fine units and floored towards minus
infinity, so minus half a second with one fine octet is coarse -1
and fine 128 — not coarse 0 with a negative fine part, which has no
field to live in.
- Resolution comes from the fine field exactly as it does for an
absolute time. A duration differenced from moments held at a finer
resolution than its own is quantised coarser than its own endpoints,
and the interval is then less precise than either moment in it.
- The arithmetic that is defined is narrow. A moment plus a duration
is a moment. A moment minus a moment is a duration. A moment plus a
moment is nothing at all, and every one of the three produces a
number.
Workflow
- Normalise the definition: coarse and fine widths only. Refuse an
epoch key outright — a relative-time definition that names one has
already been confused with an absolute-time definition.
- Derive the resolution from the fine field and the signed range from
the coarse field, and state the range asymmetrically rather than as
a magnitude.
- Encode by scaling to fine units and flooring towards minus
infinity, then splitting so the fine part is non-negative. Refuse a
coarse count outside the two's-complement range.
- Decode by the inverse, refusing a negative fine count and a coarse
count the field cannot hold.
- Offset a moment by a duration through a checked addition: refuse a
result before the epoch and a result at or past the span of the
absolute field, rather than returning a number that encodes
somewhere else.
- Difference two moments into a duration and check the result against
the signed range before it is stored; a long mission easily exceeds
a short coarse field.
- Accumulate durations term by term and refuse on the running total,
not on the final one — an intermediate that left the range already
lost the answer.
Pitfalls
- Reading a duration against an epoch. The result is a plausible
timestamp, and nothing downstream questions it.
- Assuming a symmetric signed range. The negative end reaches one step
further, and a bound derived from the positive end rejects a legal
value while a bound derived from the negative end admits an illegal
one.
- Encoding a negative duration as a negative fine count. There is no
field for it; the sign belongs to the coarse count alone.
- Rounding a negative duration towards zero. Flooring and truncating
agree above zero and disagree below it, so the sign of the error
flips halfway through the range.
- Differencing two moments held against different epochs. The interval
is wrong by the epoch offset and stays in range.
- Checking only the final accumulated total. An intermediate overflow
has already discarded information the final value cannot recover.
Behavior contract (gate 3)
The epoch-free definition, resolution and asymmetric signed range,
floor-towards-minus-infinity encoding, non-negative fine count, decode
refusals, moment-plus-duration and moment-minus-moment arithmetic,
running-total accumulation and the usage assessment are exercised by the
gate 3 contract test: scripts/test_e7041_relative_time.py against
scripts/e7041_relative_time_logic.py (stdlib unittest, offline). Run:
python3 scripts/test_e7041_relative_time.py
Compliance
- ECSS standards are freely downloadable (ESA); cite the source and
paraphrase per standards-map.yaml.
- compliance: STANDARDS-REF, gated: false.
1---2name: e7041-relative-time3description: "Compute and encode the relative-time parameters a packet definition declares, under ECSS-E-ST-70-41C clause 7.3.11. Use when a collection interval, an offset from a reference or a gap between two events is being carried in a packet: keeping a duration epoch-free so nobody reads it as a date, holding it as a signed two's-complement coarse count whose negative reach is one step longer than its positive one, flooring towards minus infinity so the fine count stays non-negative, and refusing a difference of moments the field cannot hold. Trigger: ecss, e-st-70-41c, pus-relative-time-parameter, signed-duration-two-s-complement, epoch-free-duration, coarse-fine-duration-encoding, absolute-minus-absolute-interval, duration-range-overflow."4license: Apache-2.05compliance: STANDARDS-REF6standards:7 - id: ecss8 reference-only: true9gated: false10domain: space-systems11pack: space-systems12compatibility: "agentskills.io SKILL.md; any SKILL.md host (Claude Code, Hermes, OpenClaw)"13metadata:14 source: https://skillmd.com/skills/ashfordeou/e7041-relative-time15 domain: space-systems16 subdomain: ecss17 tags: [ecss, e-st-70-41-packet-utilisation-scope, e7041-relative-time, pus-relative-time-parameter, signed-duration-two-s-complement, epoch-free-duration, coarse-fine-duration-encoding, duration-range-overflow]18 version: 0.1.019 author: Aero Agent Skills20---2122# ECSS Packet Utilisation — Relative-Time Data Type (space-systems/ecss/e7041-relative-time)2324Use when the task is the relative-time data type of ECSS-E-ST-70-41C25clause 7.3.11 — the three normative items that make a duration a26different thing from a moment, even though the two are counted with the27same coarse-and-fine fields.2829## Domain quick reference3031- A relative-time parameter carries a duration: a collection interval,32 an offset from a reference time, a timeout, the gap between two33 events. It is not measured from anywhere.34- It has no epoch, and that absence is the point. Applying an epoch to35 a duration turns a twelve-second interval into a date twelve seconds36 after the epoch, and the date looks entirely reasonable in a display.37- It is signed. An offset can point before its reference and a drift38 can go the other way, so the coarse count is a two's-complement39 quantity. That makes the range asymmetric: a one-octet coarse field40 reaches -128 but only +127, and code that assumes a symmetric range41 fails at exactly one value.42- The fine count stays non-negative whatever the sign of the duration.43 The total is counted in fine units and floored towards minus44 infinity, so minus half a second with one fine octet is coarse -145 and fine 128 — not coarse 0 with a negative fine part, which has no46 field to live in.47- Resolution comes from the fine field exactly as it does for an48 absolute time. A duration differenced from moments held at a finer49 resolution than its own is quantised coarser than its own endpoints,50 and the interval is then less precise than either moment in it.51- The arithmetic that is defined is narrow. A moment plus a duration52 is a moment. A moment minus a moment is a duration. A moment plus a53 moment is nothing at all, and every one of the three produces a54 number.5556## Workflow57581. Normalise the definition: coarse and fine widths only. Refuse an59 epoch key outright — a relative-time definition that names one has60 already been confused with an absolute-time definition.612. Derive the resolution from the fine field and the signed range from62 the coarse field, and state the range asymmetrically rather than as63 a magnitude.643. Encode by scaling to fine units and flooring towards minus65 infinity, then splitting so the fine part is non-negative. Refuse a66 coarse count outside the two's-complement range.674. Decode by the inverse, refusing a negative fine count and a coarse68 count the field cannot hold.695. Offset a moment by a duration through a checked addition: refuse a70 result before the epoch and a result at or past the span of the71 absolute field, rather than returning a number that encodes72 somewhere else.736. Difference two moments into a duration and check the result against74 the signed range before it is stored; a long mission easily exceeds75 a short coarse field.767. Accumulate durations term by term and refuse on the running total,77 not on the final one — an intermediate that left the range already78 lost the answer.7980## Pitfalls8182- Reading a duration against an epoch. The result is a plausible83 timestamp, and nothing downstream questions it.84- Assuming a symmetric signed range. The negative end reaches one step85 further, and a bound derived from the positive end rejects a legal86 value while a bound derived from the negative end admits an illegal87 one.88- Encoding a negative duration as a negative fine count. There is no89 field for it; the sign belongs to the coarse count alone.90- Rounding a negative duration towards zero. Flooring and truncating91 agree above zero and disagree below it, so the sign of the error92 flips halfway through the range.93- Differencing two moments held against different epochs. The interval94 is wrong by the epoch offset and stays in range.95- Checking only the final accumulated total. An intermediate overflow96 has already discarded information the final value cannot recover.9798## Behavior contract (gate 3)99100The epoch-free definition, resolution and asymmetric signed range,101floor-towards-minus-infinity encoding, non-negative fine count, decode102refusals, moment-plus-duration and moment-minus-moment arithmetic,103running-total accumulation and the usage assessment are exercised by the104gate 3 contract test: scripts/test_e7041_relative_time.py against105scripts/e7041_relative_time_logic.py (stdlib unittest, offline). Run:106python3 scripts/test_e7041_relative_time.py107108## Compliance109110- ECSS standards are freely downloadable (ESA); cite the source and111 paraphrase per standards-map.yaml.112- compliance: STANDARDS-REF, gated: false.