Skip to main content

Global Clock Python Library

Project description

cloca - Global Clock Python Library

License

cloca is a simple Python library that provides a global clock with functionalities to increment time, read the current time, and reset the clock. It is designed to be used across multiple modules, ensuring they all share the same state.

Features

  • Global clock with manual time incrementation.
  • Read the current time from anywhere in your Python project.
  • Obtain future time after a specified delay.
  • Reset the clock to zero as needed.

Installation

You can install cloca using pip:

pip install cloca

Usage

Importing cloca

from cloca import increase, now, reset

Increasing Time

Use the increase function to manually increment the global clock time by a specified amount.

# Increase time by 5 units
increase(5)

Reading Current Time

Use the now function to get the current time from anywhere in your project.

current_time = now()
print(f"Current time: {current_time}")

Resetting the Clock

You can reset the global clock to zero using the reset function.

reset()

Example

Here's a simple example showcasing the usage of cloca:

from cloca import increase, now

# Increase time by 10 units
increase(10)

# Read the current time
current_time = now()
print(f"Current time: {current_time}")

# Reset the clock to zero
reset()

# Read the time after resetting
current_time = now()
print(f"Current time after reset: {current_time}")

About the Name

The name "cloca" comes from the Latin word "clocca" (also spelled "cloca"), which means "bell." In this context, it represents a bell-like timekeeping mechanism. Just like a bell that rings to mark the passing of time, cloca acts as a global clock to manage time in Python projects.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Contributing

Contributions to cloca are welcome! Feel free to open issues and submit pull requests for any bug fixes or new features.

Issues

If you encounter any problems or have questions, please feel free to open an issue here.

Acknowledgments

This project was inspired by the need for a simple global clock for Python projects.

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

cloca-1.1.1.tar.gz (15.1 kB view details)

Uploaded Source

File details

Details for the file cloca-1.1.1.tar.gz.

File metadata

  • Download URL: cloca-1.1.1.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for cloca-1.1.1.tar.gz
Algorithm Hash digest
SHA256 487ffa80abac422d629add64da2afc24951cfc3fba4d7faf4a801683e8396c93
MD5 61cd013768724e036e69b109aded7cd1
BLAKE2b-256 900216746723171be6fb6634f1a5a5a4ba25cf79a638bd98faaefad16c0e97a7

See more details on using hashes here.

Supported by

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