Fix stupid logic inversion bugs, and format time correctly.