Add a check for EOVERFLOW errno and adjust tm_isdst in this case too, this way we get correct timestamp even for times with bogus isdst under NetBSD. Skip the retry if tm_isdst is already 0. Restore original value of tm_isdst if retrying also fails. Handle this way both calls to mktime(), not just the last one.