Add a check for EOVERFLOW errno and adjust tm_isdst

Checks EOVERFLOW as well for retrying. 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.