Refactor db_helper_compare_days()

Proposed fix for https://www.mantisbt.org/bugs/view.php?id=17980

I have not fully tested this.
In multiple places/files we use $t_days_old, which is confusing.  In others we use something like $c_time_length.  We should think of the right name, but $t_days_old gives the impression that the unit is a day rather than a second.