https://github.com/andrewpetrochenkov/elapsed.py
:snake: :clock1: :clock2: :clock3: :clock4: :clock5: :clock6: :clock7: :clock8: :clock9: elapsed time
https://github.com/andrewpetrochenkov/elapsed.py
python
Last synced: 3 months ago
JSON representation
:snake: :clock1: :clock2: :clock3: :clock4: :clock5: :clock6: :clock7: :clock8: :clock9: elapsed time
- Host: GitHub
- URL: https://github.com/andrewpetrochenkov/elapsed.py
- Owner: andrewpetrochenkov
- License: unlicense
- Created: 2018-10-11T00:03:14.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-12-03T20:52:30.000Z (over 4 years ago)
- Last Synced: 2025-02-21T01:48:15.129Z (3 months ago)
- Topics: python
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://pypi.org/project/elapsed/)
[](https://unlicense.org/)
[](https://github.com/andrewp-as-is/elapsed.py/actions)### Installation
```bash
$ [sudo] pip install elapsed
```#### Features
+ accepts `datetime` or pid. `os.getcwd()` by default#### Examples
`datetime` elapsed time
```python
>>> dt = datetime.datetime.now()
>>> time.sleep(2)
>>> elapsed.get(dt)
'00:02'
```process elapsed time by pid (`os.getpid()` by default)
```python
>>> 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()`
```python
>>> elapsed.seconds(1)
232238
>>> elapsed.minutes(1)
3870
>>> elapsed.hours(1)
64
>>> elapsed.days(1)
2
```