Skip to main content

A simple time utility package for getting current time in various formats

Project description

PyClockKit 🕐

A simple, lightweight Python package for getting the current time in various formats. Perfect for learning PyPI package publishing!

Features

  • ⏰ Get current local time in custom formats
  • 🌍 Get current UTC time
  • 📊 Get Unix timestamp
  • 🎯 Simple, intuitive API
  • 📦 Zero dependencies
  • 🐍 Python 3.8+ support

Installation

pip install pyclock-kit

Quick Start

from pyclock import get_time, get_timestamp, get_utc_time

# Get current time (default format)
print(get_time())
# Output: 2025-12-03 22:48:59

# Get time with custom format
print(get_time("%H:%M:%S"))
# Output: 22:48:59

# Get Unix timestamp
print(get_timestamp())
# Output: 1701637739.123456

# Get UTC time
print(get_utc_time())
# Output: 2025-12-03 21:48:59

API Reference

get_time(format=None)

Get the current local time as a formatted string.

Parameters:

  • format (str, optional): Format string for datetime.strftime(). If None, returns "%Y-%m-%d %H:%M:%S".

Returns:

  • str: Current local time as a formatted string.

Examples:

get_time()                    # '2025-12-03 22:48:59'
get_time("%H:%M:%S")          # '22:48:59'
get_time("%B %d, %Y")         # 'December 03, 2025'
get_time("%A, %I:%M %p")      # 'Tuesday, 10:48 PM'

get_timestamp()

Get the current Unix timestamp.

Returns:

  • float: Current time as Unix timestamp (seconds since epoch).

Example:

get_timestamp()  # 1701637739.123456

get_utc_time(format=None)

Get the current UTC time as a formatted string.

Parameters:

  • format (str, optional): Format string for datetime.strftime(). If None, returns "%Y-%m-%d %H:%M:%S".

Returns:

  • str: Current UTC time as a formatted string.

Example:

get_utc_time()  # '2025-12-03 21:48:59'

Development

Setting up development environment

# Clone the repository
git clone https://github.com/yourusername/pyclock-kit.git
cd pyclock-kit

# Install in editable mode with dev dependencies
pip install -e ".[dev]"

Running tests

pytest
pytest --cov=pyclock  # Run with coverage

Code formatting

black .
flake8
mypy pyclock

Building and Publishing

See PUBLISHING.md for detailed instructions on how to build and publish this package to PyPI.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Changelog

0.1.0 (2025-12-03)

  • Initial release
  • Basic time retrieval functions
  • Support for custom time formats
  • UTC time support
  • Unix timestamp support

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

pyclock_kit-0.1.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

pyclock_kit-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file pyclock_kit-0.1.0.tar.gz.

File metadata

  • Download URL: pyclock_kit-0.1.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for pyclock_kit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 20fc868040cba91d04552883998239ee03dbb3e50d99d0180604e224f0a672d3
MD5 ac3a97d2c3552c4ca56c438dfa6bd722
BLAKE2b-256 0bf0e79d71ea1d228f63f9bd14e1b048622eb901b58d821265cb2fd6d8c11783

See more details on using hashes here.

File details

Details for the file pyclock_kit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyclock_kit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for pyclock_kit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5328ab48a0e8dc5166b6c91f827cbbb2383dd95078a7b17004dcf5a847e0e167
MD5 b6606991177104eb966bbe475be9b806
BLAKE2b-256 0963cb1991bf3f104dce66e30d8ac11877234c2e9b5eae22eb373115583525c9

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