Customize get_total_time function for db schema change.