Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
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.
You can install cloca using pip:
pip install cloca
from cloca import increase, now, reset
Use the increase
function to manually increment the global clock time by a specified amount.
# Increase time by 5 units
increase(5)
Use the now
function to get the current time from anywhere in your project.
current_time = now()
print(f"Current time: {current_time}")
You can reset the global clock to zero using the reset
function.
reset()
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}")
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.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Contributions to cloca are welcome! Feel free to open issues and submit pull requests for any bug fixes or new features.
If you encounter any problems or have questions, please feel free to open an issue here.
This project was inspired by the need for a simple global clock for Python projects.
FAQs
Global Clock Python Library
We found that cloca demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.