@tcl-y2k/core
v1.0.0-rc2
Published
TCL-Y2K: Easy Date Entry for Users · Effortless Date Management in Any Database
Maintainers
Readme
TCL-Y2K: Universal 3-Track Time Code Layer
Easy Date Entry for Users · Effortless Date Management in Any Database
Specification Version:1.0.0-rc2
Reference Epoch:2000-01-01T00:00:00ZUTC (Day 0)
Core Architecture: The Universal Triad (Semantic Expression · Deterministic B-Tree Bounds · Micro-Temporal Synchronization)
┌────────────────────────────────────────────────────────────────────────────────────────┐
│ TCL-Y2K │
└───────────────────────────────────────────┬────────────────────────────────────────────┘
│
┌───────────────────────────────────┼───────────────────────────────────┐
▼ ▼ ▼
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ TRACK 1: SEMANTIC│ │ TRACK 2: MACRO │ │ TRACK 3: MICRO │
│ (Human & Logic) │ │ (B-Tree Bounds) │ │ (Sync Timecode) │
│ "circa 1976?" │ ────────────► │ tcl_start_day │ ─────────────► │ media_offset_ms │
│ "2024-Q3" │ │ tcl_end_day │ │ SMPTE 00:23:45 │
│ "1955..2011" │ │ [start_day, end_day] │ │ Tick Offsets │
└──────────────────┘ └──────────────────────┘ └──────────────────┘1. Introducing TCL-Y2K
TCL-Y2K (Universal 3-Track Time Code Layer) is a sovereign coordinate engine format. It is easy for humans to read and write. It is easy for machines and relational databases to index and query without slow regex scans. It bridges the gap between expressive text strings and exact point-in-time timestamps. TCL-Y2K is a text format designed for natural, effortless data entry. It allows everyday users, archivists, and catalogers to enter dates exactly as they read and write them (early 1950s, 13th century, 53 BCE, c1976, 1998..2004), using intuitive, punctuation-friendly conventions that prevent input errors in search bars, web forms, and catalog databases. These properties make TCL-Y2K an ideal temporal data-entry and interchange format.
TCL-Y2K is built on three structures:
- A semantic presentation track. In various systems, this is a human-readable expression of precision and certainty (
1976-u,2024-Q3,1955-02-24..2011-10-05). - A macro epoch track. In most languages and databases, this is realized as a signed 64-bit integer bounding box of
[start_day, end_day], anchored to2000-01-01(Day 0). - A micro media track. This represents sub-microsecond time bounds or millisecond video/audio streaming offsets (
media_offset_ms).
These are universal temporal structures supported across virtually all modern databases, astronomical systems, and financial architectures. In TCL-Y2K:
- A closed interval is a fixed temporal range separated by
..double dot (1976..1985). - An open start bound is a range without a known beginning (
..1984). - An open end bound is a range without a known conclusion (
2020-01-01..). - An exact calendar date adheres to standard ISO 8601 (
YYYY-MM-DD) (e.g.2024-03-15,2000-01-01), parsing with zero migration churn as the baseline starting point for precise time. - A value can be a standard year (
1976), fiscal quarter (2024-Q1), semester (2024-S1), or season (1984-Fall). - A year expresses uncertainty or approximation with URL-safe suffixes (
1976-u,c1976,1976-a,198X). - A historical expression captures natural human historiographical and archival notation: ordinal centuries (
13th century,5th century BCE), sub-decade partitions (early 1950s,mid 1940s,late 1960s), plural decades (1950s), and BCE dates (53 BCE,c53 BCE,53-03-15 BCE). - A macro epoch coordinate is a signed 64-bit integer spanning ±5.8 trillion days (±292 billion years) with sub-microsecond interval overlap logic:
start_day <= B.end AND end_day >= B.start.
Excepting a few secondary EDTF compatibility details, that completely describes the engine.
2. Supported Formats & Syntax Reference
TCL-Y2K unifies modern ISO timestamps, archival historical conventions, EDTF masked wildcards, and natural language temporal periods into deterministic bounding boxes:
| Format / Category | Syntax Input Example | B-Tree Day Range [tStartDay, tEndDay] | Precision | Certainty | Presentation Display |
| :--- | :--- | :--- | :--- | :--- | :--- |
| Ordinal Century (CE) | 13th century | [-291828, -255305] (1201..1300) | century | exact | 13th century |
| Ordinal Century (BCE) | 5th century BCE | [-912741, -876217] (-0499..-0400) | century | exact | 5th century BCE |
| Sub-Decade Early | early 1950s | [-18262, -16802] (1950..1953) | decade | approximate | early 1950s |
| Sub-Decade Mid | mid 1940s / middle 1940s | [-20454, -19359] (1944..1946) | decade | approximate | mid 1940s |
| Sub-Decade Late | late 1960s | [-12053, -10958] (1967..1969) | decade | approximate | late 1960s |
| Natural Decade | 1950s / 1950's | [-18262, -14611] (1950..1959) | decade | inferred | 1950s |
| Masked Century | 19xx / 19XX | [-36524, -1] (1900..1999) | century | inferred | 1900s century |
| Masked Decade | 198x / 198X | [-7305, -3653] (1980..1989) | decade | inferred | 1980s decade |
| Masked Millennium | 1xxx / 1XXX | [-365242, 0] (1000..1999) | century | inferred | 1000s millennium |
| Historical Year (BCE) | 53 BCE / 53 BC | [-749478, -749113] (astro -52) | year | exact | 53 BCE |
| Approximate BCE Year | c53 BCE / 53 BCE~ | [-749478, -749113] (astro -52) | year | approximate | circa 53 BCE |
| BCE Calendar Day | 53-03-15 BCE | [-749404, -749404] | day | exact | 53-03-15 BCE |
| BCE Calendar Quarter | 53-Q1 BCE | [-749478, -749388] | quarter | exact | Q1 53 BCE |
| BCE Closed Interval | 53 BCE..44 BCE | [-749478, -745826] | day | exact | 53 BCE – 44 BCE |
| Cross-Era Interval | 44 BC..14 AD | [-746190, -725007] | day | exact | 44 BC – 14 AD |
| Partition Interval | early 1950s..late 1960s | [-18262, -10958] (1950..1969) | day | exact | early 1950s – late 1960s |
| Century Interval | 13th century..14th century | [-291828, -218781] (1201..1400) | day | exact | 13th century – 14th century |
| Exact Year (CE) | 1976 | [-8766, -8401] | year | exact | 1976 |
| Uncertain Year | 1976-u / 1976? | [-8766, -8401] | year | uncertain | possibly 1976 |
| Approximate Year | 1976-a / c1976 / 1976~ | [-8766, -8401] | year | approximate | circa 1976 |
| Inferred Year | 1976-i / 1976% | [-8766, -8401] | year | inferred | inferred 1976 |
| Calendar Quarter | 2024-Q3 | [8948, 9039] | quarter | exact | Q3 2024 |
| Calendar Semester | 2024-S1 / 2024-H1 | [8766, 8947] | semester | exact | S1 2024 |
| Named Season | 1976-Spring / 1976-21 | [-8706, -8615] | season | exact | Spring 1976 |
| Exact Date (ISO 8601) | 2000-01-01 / 2024-03-15 | [0, 0] / [8839, 8839] | day | exact | 2000-01-01 / 2024-03-15 |
| Exact Timestamp | 1991-09-17T23:11:04Z | [-3028, -3028] (sec: 83464) | second | exact | 1991-09-17T23:11:04Z |
| Open Start Bound | ..1984 / ../1984 | [-2147483648, -5479] | day | inferred | before 1984 |
| Open End Bound | 2020-01-01.. / 2020-01-01/..| [7305, 2147483647] | day | inferred | after 2020-01-01 |
| Micro Media Sync | 1984-01-24T10:00:00Z#1425000ms | Day: -5821, Sec: 36000, Offset: 1425000ms | second | exact | 1984-01-24T10:00:00Z |
ISO 8601 (
YYYY-MM-DD) as the Precise Baseline: Standard ISO 8601 serves as the universal foundation for exact calendar dates. TCL-Y2K natively adopts this standard, meaning exact inputs like2024-03-15or2000-01-01act as the starting point and require no conversion.However, real-world information is frequently less exact. Human memory, historical records, and everyday planning often naturally express time as a span or an approximation—such as "circa 1976", "the 1950s", or "Q3 2024". When systems expect a precise day, recording these broader timeframes often requires defaulting to a specific date (like January 1st), which can inadvertently obscure the true, approximate nature of the original information.
TCL-Y2K builds upon ISO 8601 to capture this natural human ambiguity. It expands the standard to safely and accurately record uncertainty (
1976-u), approximations (c1976), intervals (1998..2004), and natural eras (13th century)—preserving the exact level of detail known, while translating them all into clean, queryable database bounds.Database & SQL Wildcard Safety Note: In relational databases (SQLite, PostgreSQL, MySQL, DuckDB),
?is the universal positional parameter placeholder / single-character wildcard, while%is the standard SQLLIKEmulti-character wildcard (WHERE col LIKE '1976%'). Storing or querying raw EDTF strings with?or%causes severe wildcard collisions, driver parameter binding bugs, and query escaping hazards. TCL-Y2K standardizes clean alphanumeric suffixes (1976-ufor uncertain,1976-ifor inferred) to ensure 100% database wildcard safety and URL route safety.Natural Archival Text vs. Raw EDTF: Standard EDTF relies exclusively on numeric interval notation. Because it does not process natural language text strings, catalogers must manually compute numeric slash intervals (
1201/1300for the 13th century), which can easily introduce off-by-one errors. TCL-Y2K accepts natural human text strings as first-class input and maps them deterministically to their correct cardinal day bounds.
3. Multi-Runtime Implementations
| Runtime | Artifact | Path | Role |
| :--- | :--- | :--- | :--- |
| Rust (#![no_std]) | Zero-alloc high-speed crate (13.5M ops/sec) | crates/tcl-y2k/ | Embedded, systems, and low-latency tick archives |
| DuckDB / Parquet | SQL analytical macro suite | duckdb/tcl_y2k.sql | Columnar OLAP analytics over millions of Parquet rows |
| TypeScript / Node / Bun| Zero-dependency npm package | src/tcl-y2k.ts & dist/ | Reference engine, CLI, and typed npm distribution |
| SQLite C Extension | Compiled shared library | src/sqlite3_tcl.c & build/sqlite3_tcl.dylib | Native SQLite UDFs for B-Tree index acceleration |
| WebAssembly | Freestanding WASM binary | src/tcl_wasm.c & dist/tcl_y2k.wasm | 5.7KB portable binary for Edge & Browser runtimes |
| Python | PyPI wheel package | python/tcl_y2k/ | Python AI / data science pipeline integration |
| Interactive Portal | Zero-dependency single page | docs/index.html | Live interactive parser, scrubber & test runner |
4. Quickstart & Usage
A. CLI Utility
# Parse human temporal expression
./src/cli.ts parse "1976-u" --notes "MOS 6502 Week 42 date code"
# Generate SQL insert row
./src/cli.ts sql "1984-01-24" --id "mac-debut" --title "Macintosh Debut" --category "hardware"
# Ingest JSON/JSONL timeline archive
./src/cli.ts ingest sample_transcripts.jsonl --out database_rows.json
# Convert signed TCL day offset back to Gregorian date
./src/cli.ts to-date -10957 # -> 1970-01-01B. SQLite C Extension & Allen's Interval Algebra
-- Load extension
.load build/sqlite3_tcl.dylib
-- Create timeline table with B-Tree indices
CREATE TABLE timeline (
id TEXT PRIMARY KEY,
title TEXT,
edtf TEXT,
tcl_start_day INTEGER,
tcl_end_day INTEGER
);
CREATE INDEX idx_timeline_range ON timeline(tcl_start_day, tcl_end_day);
-- Insert records using native UDFs
INSERT INTO timeline VALUES
('evt1', 'Apple II Era', '1976..1985', tcl_start_day('1976..1985'), tcl_end_day('1976..1985')),
('evt2', 'Macintosh Debut', '1984-01-24', tcl_start_day('1984-01-24'), tcl_end_day('1984-01-24'));
-- Allen's Interval Algebra: Query all events overlapping the 1980s decade
SELECT * FROM timeline
WHERE tcl_overlaps(tcl_start_day, tcl_end_day, tcl_start_day('198X'), tcl_end_day('198X'));C. WebAssembly in JavaScript / Bun / Node
import { readFileSync } from "fs";
const wasmBuffer = readFileSync("dist/tcl_y2k.wasm");
const { instance } = await WebAssembly.instantiate(wasmBuffer, {});
const wasm = instance.exports;
// Calculate signed day offset from Y2K epoch:
const day = wasm.date_to_tcl_day(1970n, 1, 1); // -> -10957nD. Python
from tcl_y2k import parse_tcl, tcl_overlaps
record = parse_tcl("1976-u")
print(record.t_start_day, record.t_end_day) # -> -8766, -8401
# Allen algebra comparison:
overlaps = tcl_overlaps(-8766, -8401, -7305, -3653)E. Rust Zero-Allocation Crate (#![no_std])
use tcl_y2k::{parse_tcl, tcl_contains, Certainty};
let jobs = parse_tcl("tcly2k:1955-02-24..2011-10-05").unwrap();
assert_eq!(jobs.t_start_day, -16382);
assert_eq!(jobs.t_end_day, 4295);
// Check if Macintosh Debut (-5821) occurred during Steve Jobs' lifetime:
assert!(tcl_contains(jobs.t_start_day, jobs.t_end_day, -5821, -5821));F. DuckDB Parquet Analytical Macros
-- Load macros
.read duckdb/tcl_y2k.sql
-- Query millions of Parquet events with zero date-parsing overhead:
SELECT id, title
FROM 'events.parquet'
WHERE tcl_overlaps(tcl_start_day, tcl_end_day, -7305, -3653); -- The 1980s Tech Boom5. Build, Test & Quality Verification
# 1. Compile native SQLite extension and WebAssembly binary:
make all
# 2. Run TypeScript reference & SQLite test suites (170 tests):
bun test
# 3. Run Rust `#![no_std]` test suite & benchmark (13.5M ops/sec):
cargo test --release --manifest-path crates/tcl-y2k/Cargo.toml -- --nocapture
# 4. Run Python conformance test suite:
python3 python/test_tcl.py
# 5. Run 1M Parquet DuckDB OLAP Benchmark:
bun run bench/duckdb_bench.ts
# 6. Quality 91 Sentinel Audit:
.forge/scripts/audit.sh6. Specification & Conformance Vectors
The formal normative definition of the 3-Track Coordinate System, bounding invariants, SQL query semantics, and polyglot reference engines:
- Interactive Online Reader (Rendered & Raw): https://tcl-y2k.org/spec.html (
docs/spec.html) - Normative Markdown Definition:
docs/specs/tcl-y2k-specification.md - 83 Conformance Vectors (.json):
docs/specs/tcl-y2k-conformance-vectors.json
Author & Governance
- Author: Ton Luong <[email protected]>
- Organization: tcl-y2k.org
- Canonical Specification: https://tcl-y2k.org
- Repository: https://github.com/tcl-y2k/tcl-y2k
License
MIT / Open Standard Specification.
