Rewrote the crap out of get_next_time()

Less ugly horrible code woo (thx kqr)