Skip to main content

Module cuc

Module cuc 

Source
Expand description

CCSDS Unsegmented Code (CUC) time format. CCSDS Unsegmented Code (CUC) Time Format (CCSDS 301.0-B-4, §3.2)

CUC encodes time as a binary count of whole seconds (coarse) and fractional seconds (fine) since a reference epoch. The number of coarse and fine bytes is configurable (1-4 each), making it flexible for different precision requirements.

§P-Field (Preamble)

The P-field is a 1-byte or 2-byte preamble that describes the time code format. When the P-field is implicit (agreed upon by sender and receiver), it may be omitted from the encoded bytes.

Byte 1:
  [7]     Extension flag (0 = 1-byte P-field, 1 = 2-byte)
  [6:4]   Time code ID: 001 = CUC with agency-defined epoch
                         010 = CUC with CCSDS epoch (TAI)
  [3:2]   Number of coarse time octets - 1 (0-3 → 1-4 bytes)
  [1:0]   Number of fine time octets (0-3 bytes)

Byte 2 (if extension flag = 1):
  [7]     Must be 0
  [6:5]   Additional coarse octets (0-3)
  [4:3]   Additional fine octets (0-3)
  [2:0]   Reserved

§CCSDS Epoch

The standard CCSDS epoch is 1958-01-01T00:00:00 TAI.

Structs§

CucConfig
Configuration for a CUC time code.
CucTime
A CUC timestamp value.

Enums§

Error
Errors for CUC time operations.
TimeCodeId
Time code IDs for the P-field.

Constants§

CCSDS_EPOCH_UNIX_OFFSET
The CCSDS epoch: 1958-01-01T00:00:00 TAI. Offset from the Unix epoch (1970-01-01) in seconds. Unix epoch = CCSDS epoch + 378_691_200 seconds.
MAX_COARSE_BYTES
Maximum number of coarse (whole-second) bytes.
MAX_FINE_BYTES
Maximum number of fine (fractional-second) bytes.