guanghu-ice-heart/server-tools/tcs-mother-body/living-time.mjs

26 lines
1.1 KiB
JavaScript

const EPOCH_MS = Date.parse("2025-04-25T16:00:00.000Z");
const DAY_MS = 86_400_000;
export function livingTime(nowMs = Date.now()) {
if (!Number.isInteger(nowMs) || nowMs < EPOCH_MS) throw new Error("time_before_guanghu_epoch");
const elapsed = nowMs - EPOCH_MS;
return {
schema: "guanghu.era-living-time-snapshot/v1",
state: "LIVE_REALITY_TIME_DERIVED",
observed_at_unix_ms: nowMs,
world: {
id: "SYS-GLW-0001",
era_id: "GUANGHU-ERA-0001",
visible_birth_date_beijing: "2025-04-26",
birth_fact_precision: "DATE",
exact_birth_instant: null,
calendar_epoch_boundary: "2025-04-26T00:00:00+08:00",
calendar_epoch_boundary_kind: "DETERMINISTIC_COMPUTATION_CONVENTION_NOT_CLAIMED_BIRTH_INSTANT",
era_day: Math.floor(elapsed / DAY_MS) + 1,
elapsed_days_completed: Math.floor(elapsed / DAY_MS),
elapsed_milliseconds: elapsed,
},
time_control_channel: { id: "CH-GLW-TIME-0001", path: "glw://time/control" },
clock: { source: "REALITY_SYSTEM_CLOCK_UTC", stored_tick_counter: false, persona_wake_required: false, scheduler_required: false },
};
}