Calculates cost of electricity.
Go to file
2024-11-04 15:39:05 +04:00
.gitignore No .o object files produced, remove it from .gitignore. 2024-05-19 21:58:29 +04:00
kwh-cost.c Version was set to 1.2.0. Now m, K, M, G, T units can be specified for wattage. Dropped support for long arguments (--). Functions were reorganised. 2024-11-04 15:20:26 +04:00
LICENSE A version was set to 1.1.2. And a year 2023 was set to 2024. 2024-04-26 04:06:31 +04:00
Makefile Remove -flto option. 2024-05-21 04:27:20 +04:00
PKGBUILD Version was set to 1.2.0. Now m, K, M, G, T units can be specified for wattage. Dropped support for long arguments (--). Functions were reorganised. 2024-11-04 15:20:26 +04:00
README.md README was updated. 2024-11-04 15:39:05 +04:00

kwh-cost

Calculates cost of electricity.

How to use

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

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

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

wattage is in Watts, but it can come with following units: m, k|K, M, G, T.

interval is in seconds, but the following units are supported: m|M for minutes; h|H for hours; and d|D for days. Also, there could be as many intervals passed as you need.

Here is an example:

$ kwh-cost 4.02 120 30d 2h

Will give 348.29.

Installation

Manually

Just run make install to build and copy executable in /usr/local/bin/, set a PREFIX= variable to change a default /usr/local path. Or just run make to only build an executable.

Use make uninstall to delete it (don't forget about the PREFIX= variable if you previously set it), or just delete ${PREFIX}/bin/kwh-cost by hand.

A LICENSE file is also being copied to ${PREFIX}/share/licenses/kwh-cost/LICENSE.

For ArchLinux

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