This function should be refactored a little bit. The `case` is not really visible and you are calling the C function `get_battery_time_remaining` too many times. Only one should be good.