Skip to main content

TimeXus: Improved sleep(), flexible time units and system utilities.

Project description

XTime-Dev

XTime is a Python library that provides enhanced time-related utilities, building upon the basic functionalities found in the standard library but without using the time module (it uses datetime instead for some features). It offers precise sleep functions, system information retrieval, and various date, time, and utility functions. It's designed to be easy to use and extend, making it suitable for a wide range of applications.

Features

  • Precise Sleep Functions:

    • xsleep(seconds): A basic sleep function similar to time.sleep().
    • XSleep.milliseconds(ms): Sleeps for the specified number of milliseconds.
    • XSleep.seconds(secs): Sleeps for the specified number of seconds.
    • XSleep.minutes(mins): Sleeps for the specified number of minutes.
    • XSleep.hours(hrs): Sleeps for the specified number of hours.
    • XSleep.get_random_delay(min_seconds, max_seconds): Sleeps for a random duration between the given minimum and maximum seconds.
    • XSleep.set_print("on" | "off"): Enable or disable the automatic "Awake!" message after sleeping.
    • XSleep.set_custom_print(message): Customize the "Awake!" message.
    • XSleep.get_total_sleep_time(): Get the total sleep time in seconds since the creation of the XSleep object or the last reset.
    • XSleep.reset_total_sleep_time(): Resets the total sleep time counter to 0.
  • System Information:

    • XSleep.get_pid(): Gets the current process ID.
    • XSleep.get_cpu_count(): Gets the number of CPU cores.
    • XSleep.is_interactive(): Checks if the session is interactive.
    • XSleep.get_platform(): Returns the platform identifier.
    • XSleep.get_uptime(): Returns the system uptime (seconds since boot).
    • XSleep.get_free_memory(): Returns the amount of free memory (in bytes).
    • XSleep.get_username(): Returns the current username.
    • XSleep.get_current_time_ms(): Returns the current time in milliseconds since the epoch.
    • XSleep.get_screen_resolution(): Returns the screen resolution (e.g., "1920x1080").
    • XSleep.get_system_info(): Returns a dictionary with system information (OS, release, version, machine, processor, username).
  • Date and Time:

    • XSleep.get_local_time(): Returns the current local time based on the system's timezone settings (in ISO 8601 format).
    • XSleep.time_since_or_until(date_str): Calculates the time elapsed since a given date or the time until a future date. The output includes years, months, and days.
  • Utility Functions:

    • XSleep.execute_command(command): Executes a shell command and returns the output.
    • XSleep.print_message_with_delay(message, delay_seconds): Prints a message with a delay before each character.
    • XSleep.generate_random_string(length): Generates a random string of the specified length.
    • XSleep.capture_screenshot(filename="screenshot.png"): Captures a screenshot and saves it to a file.
    • XSleep.get_clipboard_content(): Gets the current content of the clipboard.
    • XSleep.set_clipboard_content(data): Sets the content of the clipboard.

Installation

From PyPI (when available):

pip install XTime (NOT VALID YET)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

timexus-0.3.2.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

TimeXus-0.3.2-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file timexus-0.3.2.tar.gz.

File metadata

  • Download URL: timexus-0.3.2.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.8

File hashes

Hashes for timexus-0.3.2.tar.gz
Algorithm Hash digest
SHA256 1b687fcb3d1db8b0be066ec8b7880c8123bff759e50e7a7ca057217d89d3f997
MD5 ae77527217c5aa21f0045c9ae1a581a5
BLAKE2b-256 1c48f7c8388f6861d7c79fde45f24b3495cf7a78b00b488d2187e82f3a707cdf

See more details on using hashes here.

File details

Details for the file TimeXus-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: TimeXus-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.8

File hashes

Hashes for TimeXus-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d814e761830712b5244037e94e41f96b8b7ec9161d6ac8db61184ea8009c2232
MD5 b26d091c26c0ce4b24b07054aea45d08
BLAKE2b-256 af7a89d352b11f50784721b10f50e49d4661fd3643290d644fa700fb57bb9aaf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page