10000 GitHub - sanderness66/tcalc: tcalc - simple command line calculator that happens to understand numbers in time stamp format
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tcalc - simple command line calculator that happens to understand numbers in time stamp format

Notifications You must be signed in to change notification settings

sanderness66/tcalc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tcalc(1)

Kozmix Go, 14-FEB-2021

tcalc

Synopsis

tcalc expr ...

Description

tcalc is a simple command line calculator that happens to understand numbers in time stamp format. In other words, you can use tcalc to add, substract, multiply or divide ordinary numbers and/or time stamps. It prints the result of the calculation both as a number (or as seconds, if you will), and in "hms" notation.

Time durations can be in any of these formats (where n denotes any integer):

.TS tab(|); l l. colon notation| n|seconds n**:n**|minutes and seconds n**:n:n**|hours, minutes and seconds

hms notation| ns|seconds nmns|minutes and seconds nhnmns|hours, minutes and seconds .TE

Operators are the usual +, -, *, / and % (and maybe others, I didn't write the arithmetic evaluator).

Examples

  1. How long is 30 minutes plus 65 seconds?

.EX $ tcalc 30m + 65s 1865 31m05s .EE

  1. If you slice an hour and twenty minutes into 30 equal parts, how long is each part?

.EX $ tcalc 1h20m / 30 160 02m40s .EE

  1. How long does Sgt. Patate's first 7 inch vinyl record run?

.EX $ tcalc 03:17 + 01:47 + 01:47 + 02:45 576 09m36s .EE

  1. If I have a video clip that runs for 1h, 23m and 45s and split it up in 10m chunks, how many 10m chunks will I get?

.EX $ tcalc 1h23m45s / 10m 8 08s .EE

Note that the 08s in this case doesn't mean anything, but tcalc doesn't know that. It's up to you to pick the result you need. Also note that tcalc rounds the answer down to the nearest integer.

  1. And how much will be left over at the end?

.EX $ tcalc 1h23m45s % 10m 225 03m45s .EE

Bugs

We make very little effort indeed checking for correct arguments, and it's very easy to cause runtime panics by feeding tcalc with incorrect arguments.

tcalc doesn't understand fractions of a second.

Author

svm

About

tcalc - simple command line calculator that happens to understand numbers in time stamp format

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0