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.
  • 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.0.1.tar.gz (14.9 kB view hashes)

Uploaded Source

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