• Decodes a Sandcorn ID into its components

    Parameters

    • sandcorn: string

      The Sandcorn ID to decode

    Returns { machineId: number; seq: number; tick: number }

    Object containing the timestamp, machine ID, and sequence number

    const id = generateId();
    const { tick, machineId, seq } = decodeSandcorn(id);

    print(`This ID was generated:`);
    print(`- On computer #${machineId}`);
    print(`- At hour ${tick} since epoch`);
    print(`- Was ID #${seq} that hour`);