Battery formula giving incorrect result

The formula for displaying amount of time left for battery to fully charge/discharge is way off. For example:

$if(bi(charging) = 0, "unplugged", "plugged")$ $tf(bi(plugged))$

This tells me it's either 2 weeks to reach full charge or 3 weeks to fully discharge. I'm on a custom rom but the android system settings for battery stats are displaying the correct info (eg 30 mins to reach full charge or 7 hours to discharge).

What would cause it to show such wrong info?