Skip to main content

No project description provided

Project description

A small helper package for working with time intervals.

This package provides a single class, Seconds, which is a subclass of int that represents a time interval in seconds. It also provides a number of constants that represent common time intervals, such as ONE_SECOND and ONE_DAY.

The intended use of this package is to provide a more readable alternative to using raw numbers for time intervals. For example, instead of writing time.sleep(86400) to sleep for one day, you can write time.sleep(ONE_DAY). This makes the code more readable and easier to understand.

The Seconds class also provides attributes for accessing the interval in other units of time, such as minutes and hours. For example, ONE_DAY.minutes is equivalent to ONE_DAY / 60, and ONE_DAY.hours is equivalent to ONE_DAY / 60 / 60.

Usage

>>> import times
>>> pytimes.ONE_DAY
86400
>>> pytimes.ONE_DAY.hours
24

Requirements

Python 3.6+

Installation

pip install pytimes

License

MIT

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

pytimes-1.0.0.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

pytimes-1.0.0-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

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