Skip to main content

A timer library for managing multiple timers for multiple individuals.

Project description

Productivity-Timer

Productivity-Timer is a Python library for managing multiple timers, one for each specified individual. It allows starting, stopping, pausing, resuming, resetting, and retrieving elapsed times for timers on a per-person basis. The library also supports optional timeouts, so timers can automatically stop after reaching a specified duration.

Features

  • Start, stop, pause, resume, and reset individual timers.
  • Track multiple timers for different individuals.
  • Optional timeout support for automatic stopping.
  • Retrieve formatted elapsed times for each person.
  • Stop and reset all timers with a single command.

Installation

To install Productivity-Timer, use pip:

pip install productivity-timer 

Usage

Importing the Library

from productivity_timer import ProductivityTimer

Quick Start

from productivity_timer import ProductivityTimer

timer = ProductivityTimer()

timer.start("Abhishek", timeout=10) 

timer.start("Ram")

timer.pause("Abhishek")  

timer.resume("Abhishek")

timer.stop("Ram")

print(f"Elapsed time for Abhishek: {timer.get_elapsed_time('Abhishek', formatted=True)}")

timer.stop_all()

print(timer)

Available Functions

  • start(person, timeout=None)
    Starts a timer for the specified person. If a timer for this person already exists, it resumes the timer. The timeout argument sets a maximum duration for the timer (in seconds).

  • stop(person)
    Stops the timer for the specified person and updates the total elapsed time.

  • pause(person)
    Pauses the timer for the specified person without resetting the elapsed time. The timer can be resumed later.

  • resume(person)
    Resumes a paused timer for the specified person.

  • reset(person)
    Resets the timer for the specified person to zero, clearing any elapsed time.

  • get_elapsed_time(person, formatted=False)
    Returns the elapsed time for the specified person. If formatted=True, the time is returned as a formatted string in HH:MM:SS.

  • get_all_elapsed_times(formatted=False)
    Returns a dictionary of elapsed times for all tracked persons. If formatted=True, times are formatted in HH:MM:SS.

  • stop_all()
    Stops all active timers.

  • reset_all()
    Resets all timers, clearing any elapsed times.

  • check_timeouts()
    Checks each timer against its timeout value (if any). If a timer's elapsed time exceeds its timeout, the timer is automatically stopped.

Examples

Setting Up a Timer with a Timeout

timer.start("Abhishek", timeout=30)  

Checking and Stopping All Active Timers

timer.stop_all()

Formatting Elapsed Time

formatted_time = timer.get_elapsed_time("Abhishek", formatted=True)
print(f"Elapsed time for Abhishek: {formatted_time}")

Contributing

Contributions are welcome! If you would like to report issues, suggest new features, or contribute code, please create a pull request or open an issue on the GitHub repository.

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

productivity_timer-1.0.2.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

productivity_timer-1.0.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file productivity_timer-1.0.2.tar.gz.

File metadata

  • Download URL: productivity_timer-1.0.2.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.10

File hashes

Hashes for productivity_timer-1.0.2.tar.gz
Algorithm Hash digest
SHA256 18ad481890e2e290716588e85669f4cfcdb6956c320e9d60e55a3e4e067e322a
MD5 594a9998795380c44b924feda66a5352
BLAKE2b-256 6ef4eda8e44c06f8d021a6b7076d945ec6b7f8bb9d8a61cf79b470a64280b359

See more details on using hashes here.

File details

Details for the file productivity_timer-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for productivity_timer-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fcc2cfa830486a3ea7d8ca58f10015e9a543ff53734761d695db0bebd40945fb
MD5 5de6958b01a2d214febefcc3e42da1bb
BLAKE2b-256 aceaf228096f9bb9fc511f4caa5e90bb779e92976e08e2fd826601def5144f9c

See more details on using hashes here.

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