Utilities & Diagnostics

Diagnostics, Stats & Utilities

TimeSeed includes robust self-monitoring diagnostics, performance tracking, structure validation, and helper utility classes.

Diagnostics, Stats & Utilities

TimeSeed includes robust self-monitoring diagnostics, performance tracking, structure validation, and helper utility classes.

Introspection & Diagnostics Functions

timeseed.validate_id(id_value: int) -> bool

Checks if the structure of a given ID could have been generated by the current generator config.

  • Parameters: id_value (int)
  • Returns: bool (True if structure is valid)

timeseed.get_info() -> Dict[str, Any]

Retrieves comprehensive details about the default generator's configuration, performance stats, and current capacity info.

  • Returns: dict containing configuration parameters, machine identifiers, and stats.

timeseed.get_performance_stats() -> Dict[str, Any]

Retrieves performance statistics.

  • Returns: dict containing performance metrics like average generation latency, sequence overflows, and total IDs generated.

timeseed.reset_performance_stats() -> None

Resets the performance tracker, starting a fresh monitoring interval.


Utility Classes

FormatUtils

A collection of static helpers for base representations and hexadecimal conversions.

  • int_to_hex(id_value: int, uppercase: bool = True, min_length: int = 32) -> str
  • hex_to_int(hex_str: str) -> int
  • int_to_base(id_value: int, alphabet: str, min_length: int = 22) -> str
  • base_to_int(base_str: str, alphabet: str) -> int
  • int_to_base32(id_value: int, min_length: int = 26) -> str
  • base32_to_int(base32_str: str) -> int

TimeUtils

Time-related helper methods.

  • get_timestamp_ms() -> int: Returns current system epoch time in milliseconds.
  • ms_to_datetime(ms: int) -> datetime: Converts a millisecond timestamp to a Python datetime object.

ValidationUtils

Static helper methods to validate identifiers.

  • validate_integer_id(id_value: int) -> None
  • validate_hex_id(hex_str: str) -> None
  • validate_base62_id(base62_str: str) -> None
  • validate_base32_id(base32_str: str) -> None