Fixed quiet-time check for cases where the times cross midnight.