Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aboehm/tsenum
Timestamp enumerator
https://github.com/aboehm/tsenum
enumerator python timestamps tool
Last synced: about 1 month ago
JSON representation
Timestamp enumerator
- Host: GitHub
- URL: https://github.com/aboehm/tsenum
- Owner: aboehm
- License: gpl-2.0
- Created: 2016-06-04T10:48:59.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2023-09-26T15:10:54.000Z (about 1 year ago)
- Last Synced: 2024-10-16T09:13:02.041Z (2 months ago)
- Topics: enumerator, python, timestamps, tool
- Language: Python
- Homepage:
- Size: 38.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tsenum
[![Tests](https://github.com/aboehm/tsenum/actions/workflows/tests.yml/badge.svg)](https://github.com/aboehm/tsenum/actions/workflows/tests.yml)
A timestamp generator.
## Install
You can use pip to install from the repository
```
pip install tsenum
```or download sources and run pip from this directory
```
git clone https://github.com/aboehm/tsenum
pip install .
```## Usage
`tsenum` provides an CLI. For help run:
```
tsenum -h
```To count 7 days back from yesterday via CLI, run:
```sh
tsenum --offset -1 --count -7 --step day --pattern "%Y-%m-%d: Hello world!"
2016-05-27: Hello world!
2016-05-28: Hello world!
2016-05-29: Hello world!
2016-05-30: Hello world!
2016-05-31: Hello world!
2016-06-01: Hello world!
2016-06-02: Hello world!
```To do it programmatically:
```python
from datetime import datetime
import tsenumprint(
tsenum.enumerate_times(
datetime.now().astimezone(),
offset=-1,
count=-7,
step=tsenum.Step.DAY,
pattern='%Y-%m-%d'
)
)
```