Astro~/0.4
** Conformance
** Astro * Conformance
** /conformance/tcf

Time Code Formats

Coverage matrix: what pkg/tcf implements from CCSDS 301.0-B-4, and what it does not.

Coverage matrix for pkg/tcf, CCSDS 301.0-B-4

CCSDS 301.0-B-4 ships no PICS proforma. It is a format definition standard, not a protocol with a conformance annex, so there is no official table to fill in. What follows is a coverage matrix written against the normative text: each row names a feature, the clause that defines it, and what this package does with it.

Every row here was checked against the standard's text rather than against a published test vector, because CCSDS 301.0-B-4 publishes none. That is worth saying plainly: each row is one implementer's reading of a clause, and a round-trip test cannot tell you it is wrong. The 14 vectors listed at the bottom pin the octets, but their derivations come from the same reading.


A. General information

Implementationgithub.com/ravisuhag/astro/pkg/tcf
StandardCCSDS 301.0-B-4, Time Code Formats
ScopeEncoding and decoding of the four time code formats, with the P-field and bare T-field forms
Not in scopeTime correlation, clock discipline, and onboard time management, none of which this standard defines

B. P-field

FeatureClauseStatusNotes
First octet: extension flag, 3-bit ID, 4 detail bitsclause 3.2.2 and per-formatY
Second octet when the extension flag is setclause 3.2.2Y
Time code ID 001, CUC Level 1clause 3.2Y
Time code ID 010, CUC Level 2clause 3.2Y
Time code ID 100, CDSclause 3.3Y
Time code ID 101, CCSclause 3.4Y
Unrecognised time code ID-Y
Implicit P-field (bare T-field)-Y

C. CUC, Unsegmented Time Code (clause 3.2)

FeatureClauseStatusNotes
Coarse time, 1-4 basic octetsclause 3.2.2YWithCUCCoarseBytes
Fine time, 0-3 basic octetsclause 3.2.2YWithCUCFineBytes
Extension octet: additional coarse (2 bits), additional fine (3 bits)clause 3.2.2YCoarse to 7 octets, fine to 10
Reserved bits 6-7 of the extension octetclause 3.2.2YA non-zero value is rejected
Out-of-range octet countsclause 3.2.2YErrInvalidCoarseOctets, ErrInvalidFineOctets
Level 1, CCSDS epoch, 1958-01-01 TAIclause 3.2YCoarse count is true TAI seconds: the offset in effect at the encoded instant is added on encode and removed on decode
Level 2, agency-defined epochclause 3.2YPurely arithmetic, no leap-second correction. WithCUCEpoch; ErrEpochRequired if omitted
Coarse value exceeding the configured widthclause 3.2.2YErrOverflow
Fine-time wire fidelity across an encode/decode cycleclause 3.2.2YFine octets are preserved as transmitted, not re-derived from a rounded duration

D. CDS, Day Segmented Time Code (clause 3.3)

FeatureClauseStatusNotes
Day segment, 16-bitclause 3.3.2Y
Day segment, 24-bitclause 3.3.2Y
Milliseconds of day, 0-86399999clause 3.3.2Y
Sub-millisecond absent (code 00)clause 3.3.2Y
Sub-millisecond microseconds (code 01, 2 octets)clause 3.3.2Y
Sub-millisecond picoseconds (code 10, 4 octets)clause 3.3.2Y
Reserved sub-millisecond code 11clause 3.3.2Y
Sub-millisecond value outside the declared resolutionclause 3.3.2Y
Extension flag on a CDS P-fieldclause 3.3.2Y
Level 1 and Level 2 epochsclause 3.3Y
Leap secondsclause 3.3N/A

E. CCS, Calendar Segmented Time Code (clause 3.4)

FeatureClauseStatusNotes
Month/Day variant (detail bit 4 = 0)clause 3.4.2YWithCCSMonthDay
Day-of-Year variant (detail bit 4 = 1)clause 3.4.2YDefault
BCD encoding of every segmentclause 3.4.1Y
Upper 4 bits of the year's first octet are zeroclause 3.4.1.2YEnforced on encode and decode
Non-BCD nibble (value above 9)clause 3.4.1YErrInvalidBCD
Sub-second octets, 0-6clause 3.4.2YWithCCSSubSecBytes; each octet holds two decimal digits
Second value 60 (the leap second)clause 3.4YAccepted and flagged; Time() normalizes it, because Go's time.Time cannot represent second 60
Calendar field range checksclause 3.4.1YMonth 1-12, day of month 1-31, day of year 1-366, hour 0-23, minute 0-59; ErrInvalidCalendarTime
Cross-checks between calendar fieldsclause 3.4.1YDerived: the standard gives per-field ranges; consistency between them is checked here as a decoder safeguard
Level 2clause 3.4N/ACCS is Level 1 UTC only, by definition

F. ASCII time codes (clause 3.5)

FeatureClauseStatusNotes
Type A, YYYY-MM-DDThh:mm:ss.d...dZclause 3.5.1.1YASCIITypeA
Type B, YYYY-DDDThh:mm:ss.d...dZclause 3.5YASCIITypeB
Fractional seconds, 1-9 digitsclause 3.5YWithASCIIPrecision; default 3
Optional Z terminatorclause 3.5YAccepted on decode, written on encode
Fixed field widths and mandatory separatorsclause 3.5YDecode enforces the subset strictly and rejects anything ISO 8601 allows but clause 3.5 does not
Second 60clause 3.5YAccepted only at 23:59:60
P-fieldclause 3.5N/AASCII codes carry no P-field

G. Time scales and leap seconds

FeatureStatusNotes
Integer TAI-UTC offset tableY
Current offsetY
Pre-1972 eraPartial
An instant inside a leap secondPartial
Future leap secondsN

H. Not implemented

ItemReason
Time correlation and clock disciplineNot defined by this standard
Agency-specific epoch registriesA mission supplies its own epoch through WithCUCEpoch or WithCDSEpoch
P-field octets beyond the secondNone are defined by CCSDS 301.0-B-4

I. Verification

The conformance regressions live in pkg/tcf/audit_test.go, tagged TCF-n per defect. They cover the TAI-UTC table against its historical values, CUC Level 1 leap-second handling, CUC Level 2 arithmetic behaviour, fine-time wire fidelity, the rejected P-field extension bit, the reserved CDS sub-millisecond code, CCS BCD and calendar validation, strict ASCII decoding, bare T-field round trips, and overflow guards on large coarse and day values.

pkg/tcf/fuzz_test.go fuzzes the decoders: arbitrary bytes must never panic and never allocate from a length field an attacker controls.

Reference


Wire test vectors

The octets backing this statement live in the vector corpus — 14 vectors. Each vector names the clause it comes from and carries the derivation that produced it.

File
tcf/timecode.json14 vectors

These are data files, so any implementation can check itself against the same octets. See CONTRACT.md for how, and how this is verified for what rests on a published vector versus a reading of the clause.