Socket
Socket
Sign inDemoInstall

cloca

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloca

Global Clock Python Library


Maintainers
1

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.

FAQs


Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc