Calculate cost of electricity.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Alexander Andreev 8556f85781
[main.{c,h}] Let's put some safety into this code! xD
3 weeks ago
src [main.{c,h}] Let's put some safety into this code! xD 3 weeks ago
.gitignore kwh-calc renamed to more suitable name kwh-cost. 1 month ago
LICENSE +NIGGER is not needed here. 1 month ago
Makefile [Makefile] Added a simple test that verifies output. Mostly as an example of use for test command. 3 weeks ago
PKGBUILD Oh, commas are not allowed here... Yikes. 4 weeks ago [] shell to console. 3 weeks ago


Calculate cost of electricity.

How to use

$ kwh-cost [OPTIONS] price wattage interval [interval ..]

Options are -v, --version to show program's version; and -h, --help to show usage of a program.

price is a price per kWh. wattage is how many Watts being consumed. interval is for how long.

interval is in seconds, but you can specify a unit. Units are the following: m for minutes; h for hours; and d for days. There could be as many intervals passed as you need.

Here is an example:

$ kwh-cost 3.68 120 30d 2h

P.S.: Yeah, I pay 3.68 rubles per kWh. Which is just $0.05. :)



First run make to build a program, and then make install to copy executable in /usr/bin/. Later, use make uninstall to delete it, or just delete /usr/bin/kwh-cost.

For ArchLinux

You can take a PKGBUILD file and in a directory with it run makepkg -i.