Refactor db_helper_compare_days()

Proposed fix for https://www.mantisbt.org/bugs/view.php?id=17980

I have not fully tested this.
I would expect that the duration can be negative.  What we are trying to avoid is ( $p_value_2 + $p_duration ) being negative.