tec is a small command-line tool that evaluates time expressions using the same rules as calculator.net’s time calculator: each value is a number followed by a unit (d days, h hours, m minutes, s seconds). You can combine several values in one term with spaces, and combine terms with + or -.
- Parses expressions like
1d 2h 3m 4s + 4h 5s - 2030s. - Prints a breakdown of the result in days/hours/minutes/seconds and equivalent totals in each unit.
- Go 1.22 or newer (only for building from source).
-
Open the Releases page on GitHub.
-
Download the archive or binary for your platform:
Platform Asset name Linux x86_64 tec-linux-amd64Linux ARM64 tec-linux-arm64macOS Intel tec-darwin-amd64macOS Apple Silicon tec-darwin-arm64Windows x86_64 tec-windows-amd64.exe -
Verify integrity (optional): the file
SHA256SUMSlists checksums for each binary.sha256sum -c SHA256SUMS
-
Install the binary on your
PATH(examples):# Linux / macOS chmod +x tec-linux-amd64 sudo mv tec-linux-amd64 /usr/local/bin/tecOn Windows, place
tec-windows-amd64.exein a folder that is on yourPATHand rename it totec.exeif you like.
git clone https://github.com/joaonunatings/tec.git
cd tec
go build -o tec .Install:
go install github.com/joaonunatings/tec@latest(Ensure $GOPATH/bin or $(go env GOPATH)/bin is on your PATH.)
tec <expression>
Expression rules
- Each value is a number (integer or decimal) immediately followed by one of
d,h,m,s(case-insensitive for the unit letter). - Inside a term, multiple values are separated by whitespace (e.g.
1d 2h 3m 4s). - Terms are separated only by
+or-(spaces do not split terms;15m 15mis one term,15m + 15mis two terms).
Examples
tec "15m 15m"
tec 15m + 15m
tec 1d 2h 3m 4s + 4h 5s - 2030sIf you omit arguments, tec prints a short usage message to stderr.
Clone the repository:
git clone https://github.com/joaonunatings/tec.git
cd tecRun tests:
make test
# or
go test -v ./...Build a local binary:
make build
# produces ./tecCross-compile all release targets (writes to ./dist/):
make releaseReleases are built automatically by GitHub Actions when a semantic version tag is pushed to the repository, and the tagged commit is on main.
-
Commit your changes on
main. -
Create an annotated tag (example
v1.0.0):git tag -a v1.0.0 -m "v1.0.0" git push origin main git push origin v1.0.0
Tag names should follow SemVer with a v prefix, for example v1.2.3 or v1.2.3-rc.1.
The workflow publishes a GitHub Release named after the tag, attaches all platform binaries under dist/ naming, and includes SHA256SUMS.
This project is licensed under the MIT License.