elapsed time
Project description
Install
$ [sudo] pip install elapsed
Features
- accepts
datetime
or pid.os.getcwd()
by default
Classes
elapsed.Elapsed
method | description |
---|---|
__init__(seconds) |
init from total seconds count |
__str__() |
format elapsed time in the form [[dd-]hh:]mm:ss |
@property | description |
---|---|
days |
return elapsed time in days |
hours |
return elapsed time in hours |
minutes |
return elapsed time in minutes |
seconds |
return elapsed time in seconds |
Functions
function | description |
---|---|
elapsed.days(input=None) |
return elapsed time in days. accepts pid or datetime |
elapsed.get(input=None) |
return elapsed.Elapsed instance. accepts pid or datetime |
elapsed.hours(input=None) |
return elapsed time in hours. accepts pid or datetime |
elapsed.minutes(input=None) |
return elapsed time in minutes. accepts pid or datetime |
elapsed.seconds(input=None) |
return elapsed time in seconds. accepts pid or datetime |
Examples
datetime
elapsed time
>>> dt = datetime.datetime.now()
>>> time.sleep(2)
>>> elapsed.time(dt)
'00:02'
process elapsed time by pid (os.getpid()
by default)
>>> import elapsed
>>> e = elapsed.get(1)
'02-16:30:38'
>>> e.days, e.hours, e.minutes, e.seconds
(2, 64, 3870, 232238)
elapsed.seconds()
, elapsed.minutes()
, elapsed.hours()
, elapsed.days()
>>> elapsed.seconds(1)
232238
>>> elapsed.minutes(1)
3870
>>> elapsed.hours(1)
64
>>> elapsed.days(1)
2
readme-md - README.md generator
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
elapsed-2018.11.20.tar.gz
(2.2 kB
view hashes)
Built Distribution
Close
Hashes for elapsed-2018.11.20-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 126654fd52b2d73e8b3bb1f61dd50e4cac7dbc9afef84c520ea8a0901d40da32 |
|
MD5 | 75a2508f43224fbb84f124605598de13 |
|
BLAKE2b-256 | 08f295c941d1af248e795e74a50e14a0764d2b6008c5f3b78a8a72122a6533a8 |