{"library":"stopwatch-py","title":"A Simple Python Stopwatch","type":"library","description":"stopwatch-py is a lightweight Python library providing a simple stopwatch functionality to measure elapsed time. It is currently at version 2.0.1 and has a low release cadence, primarily focusing on minor improvements and maintenance.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install stopwatch-py"],"cli":null},"imports":["from stopwatch import Stopwatch"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/ravener/stopwatch.py","docs":null,"changelog":null,"pypi":"https://pypi.org/project/stopwatch-py/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"from stopwatch import Stopwatch\nimport time\n\ns = Stopwatch() # Starts automatically on creation\nprint(f\"Stopwatch started. Elapsed: {s.duration:.2f}s\")\n\ntime.sleep(1.5)\nprint(f\"After 1.5s, Elapsed: {s.duration:.2f}s\")\n\ns.stop()\nprint(f\"Stopwatch stopped. Elapsed: {s.duration:.2f}s\")\n\ntime.sleep(0.5)\nprint(f\"After 0.5s while stopped, Elapsed: {s.duration:.2f}s (should be same)\")\n\ns.start() # Resume\ntime.sleep(0.75)\nprint(f\"After resuming for 0.75s, Total Elapsed: {s.duration:.2f}s\")\n\ns.reset() # Reset to 0 and stop\nprint(f\"Stopwatch reset. Elapsed: {s.duration:.2f}s\")","lang":"python","description":"Initializes a stopwatch, measures time, stops and resumes, then resets it.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}