zeus-time
Version:
A next-gen, deterministic timekeeping standard. UNIX is dead. ZEUS lives.
40 lines (39 loc) • 1.52 kB
TypeScript
export declare function generateZeusHash(timestamp: string): Promise<string>;
export declare function unixToZeus(unixTime: number): string;
export declare function zeusToUnix(zeusTime: string): number;
/**
* Ensures a timestamp is in ISO format for hashing.
* Accepts Date objects, ISO strings, or UNIX timestamps.
* @param input - Any time format.
* @returns ISO timestamp string.
*/
export declare function normalizeTimestamp(input: string | number | Date): string;
/**
* Ensures a given input is a valid UNIX timestamp.
* @param timestamp - UNIX timestamp in seconds.
* @returns True if valid, otherwise false.
*/
export declare function isValidUnixTimestamp(timestamp: number): boolean;
/**
* Checks if a string is a valid BLAKE3 hash (64-char hex).
* @param hash - Hash to validate.
* @returns True if valid, otherwise false.
*/
export declare function isValidZeusHash(hash: string): boolean;
/**
* Logs messages in a formatted manner.
* @param message - The message to log.
* @param level - Log level: "info", "warn", "error".
*/
export declare function log(message: string, level?: "info" | "warn" | "error"): void;
/**
* Converts a UNIX timestamp to a human-readable string.
* @param unixTime - UNIX timestamp in seconds.
* @returns Formatted date string.
*/
export declare function unixToHuman(unixTime: number): string;
/**
* Syncs local system time with an external NTP server.
* @returns Promise<Date> - Synchronized time.
*/
export declare function syncWithNTP(): Promise<Date>;