blob: b8d70aa685f0ed50297b31cdc6901185e45453a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/usr/bin/env python3
charge_now_path = "/sys/class/power_supply/BAT0/charge_now"
current_now_path = "/sys/class/power_supply/BAT0/current_now"
f = open(charge_now_path, "r")
charge_now = int(f.readlines()[0])
f = open(current_now_path, "r")
current_now = int(f.readlines()[0])
ratio = charge_now / current_now * 100
hours = ratio / 60
minutes = ratio % 60
print(str(hours) + ":" + str(minutes))
|