Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oppodelldog/dur
duration calculation
https://github.com/oppodelldog/dur
Last synced: 5 days ago
JSON representation
duration calculation
- Host: GitHub
- URL: https://github.com/oppodelldog/dur
- Owner: Oppodelldog
- License: mit
- Created: 2022-01-01T15:07:36.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-06T16:59:13.000Z (over 2 years ago)
- Last Synced: 2023-02-27T08:42:12.151Z (almost 2 years ago)
- Language: Go
- Size: 894 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dur
dur is a CLI tool for calculation of durations.
![DUR](dur.png)
## Installation
with go installed run:
```bash
go install github.com/Oppodelldog/dur@latest
```## Usage
```bash
# calculate with durations
> dur 12h - 1m + 60s
12h0m0s# floating point durations
> dur 0,1666666666667h
10m0s# default operation is addition
> dur 12h1m60s
12h2m0s# units support
> dur 1h1m1s1ms1us1ns
1h1m1.001001001s# parentheses support
> dur "2h-(1h30m)"
30m0s# multiplication
> dur 5*4*12*8h
1920h0m0s# division
> dur 40h/5
8h0m0s
```### verbose output
```bash
# -p=h for printing calculations in a human readable form
> dur -p=h 12h - 1m + 60s
12h0m0s - 1m0s = 11h59m0s
11h59m0s + 1m0s = 12h0m0s
12h0m0s# -p=n for printing calculations in nanoseconds
> dur -p=n 12h - 1m + 60s
43200000000000 - 60000000000 = 43140000000000
43140000000000 + 60000000000 = 43200000000000
12h0m0s
```## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)