← All packages

Time & Earth rotation

star-timecode 0.1.0

CCSDS ASCII time codes A and B, strict

Public state: Released & Verified. The registry label is RELEASED. What the states mean →

Apache-2.0 Released & Verified single file

Summary

Strict reader and writer of the CCSDS 301.0-B-4 ASCII time codes A (calendar) and B (day of year), with the fraction kept as its digits; fields equal to CPython datetime and numpy.datetime64 on 600 instants and to astropy on the 331 between 1900 and 2100; refuses all 40 malformed or out-of-range texts of the corpus, of which the ISO parsers of those libraries accept 10 to 14.

Run in your browser

Edit the code and press Run (or Ctrl+Enter). Python runs in your browser with this package's published code. The first run downloads Python once (about 12 MB).

Runs in the browser: all 86 tests pass in the browser's Python (Pyodide 314.0.7, Python 3.14.2), measured on 20 October 2026.

Use it on your computer

No account and no GitHub needed. Download, then install with one command:

python -m pip install star_timecode-0.1.0-py3-none-any.whl

In Python: import star_timecode

Get started →

Cite it, and its bill of materials

For a paper, a report or a supplier file: the citation in two formats, and the software bill of materials (SBOM) in the two standard formats, with the fingerprint of the wheel.

@software{cavazzini_star_timecode_0_1_0,
  author  = {Cavazzini, Andrea},
  title   = {{star-timecode}: CCSDS ASCII time codes A and B, strict},
  version = {0.1.0},
  year    = {2026},
  url     = {https://andrea07072000.github.io/S.T.A.R.-/software/star_timecode/},
  note    = {Apache-2.0. Source: https://github.com/Andrea07072000/S.T.A.R.-, commit dc09f61d}
}

For developers

Install directly from the public repository:

python -m pip install "star-timecode @ git+https://github.com/Andrea07072000/S.T.A.R.-.git@dc09f61dcee098d518f070d6a23a8815defc1109#subdirectory=packages/star_timecode"

README · tests · evidence (GitHub)

Technical sheet

Package
star-timecode
Import name
star_timecode
Version
0.1.0
Licence
Apache-2.0
Python
>=3.9
Dependencies
none (standard library only)
Capability
star.time.ccsds-ascii-timecode
Maturity
Released & Verified (RELEASED)
Published commit
dc09f61d

Requirements

  • R1 parse(text) accepts code A YYYY-MM-DDThh:mm:ss[.d...][Z] and code B YYYY-DDDThh:mm:ss[.d...][Z] and returns (year, month, day, hour, minute, second, fraction). The fraction is returned as its string of digits (up to 12): nothing passes through a float, and a code read and written again is the same text.
  • R2 format_a and format_b write the two codes from the same fields; day_of_year and month_day convert between the two date forms with the Gregorian leap-year rule, years 0001 to 9999.
  • R3 Measured on 600 instants written in both codes: calendar fields, microseconds and day of year equal to CPython datetime and numpy.datetime64 on all 600 and to astropy on the 331 between 1900 and 2100. Of 40 malformed or out-of-range texts, all 40 are refused.
  • R4 Every function returns its result or raises ValueError: wrong shape (widths, separators, case, spaces, signs, offsets, non-ASCII digits), a date or time that does not exist, second 60 anywhere but 23:59, arguments of the wrong type.

Limits (what is not claimed)

Syntax and calendar only. Second 60 is accepted at 23:59 of any date: whether a leap second really occurred there is a question for a leap-second table (see star_timescales in this repository), not for this module. No time zones or offsets (the codes are UTC), no truncated forms (date only, no seconds), no conversion to seconds, Julian dates or other time scales, no years before 0001 or after 9999. The limit of 12 fraction digits is this module's, not the standard's.

Release gate

Computed by the registry from the result files, with the same function that decides RELEASED.

Mutation score, latest measure of each module (needs at least 0.850)
  • star_timecode.py 1.000 (2026-10-07)
Independent implementations written by others (needs 2)
astropy.time.Time, CPython datetime, numpy.datetime64
Result
Released & Verified

Evidence in the registry

CheckStatusRecordedWhat was observed
Clean install from the release tagVERIFIED2026-10-07pytest outside the tree: 86 passed in 0.52s
Unit testsVERIFIED2026-10-0786 passed in 0.87s
ReviewVERIFIED2026-10-07Requirements, interface, units, data provenance, dependency surface and failure behaviour reviewed
ReviewVERIFIED2026-10-07Re-running the cross-check gives a byte-identical evidence file
Reference valueVERIFIED2026-10-07parse of both texts = (1988, 1, 18, 17, 20, 43, '123456'); format_b of those fields = '1988-018T17:20:43.123456Z' (suite: 86 passed in 0.87s)
Cross-check with independent librariesVERIFIED2026-10-07star_timecode reads and writes CCSDS ASCII time codes A and B with exact fields and refuses every text that is not one
BenchmarkVERIFIED2026-10-07field mismatches: 0; malformed texts refused: 40 of 40

Fingerprints (SHA-256)

star_timecode-0.1.0-py3-none-any.whl53ce07840dfd001c33f88d2c708da687914a6f10813d023a0673d34a993ff8da
star_timecode.pyf19c8b3847601f8c18582d864cfdf47af255186e70e0ebd52533146350271c50
star_timecode-0.1.0-source.zip179237676e3e820e68dc2fd696a611c3721ec2ecc81015543ade13dd4f4869f5

results