Do time sorting, correctly