From: Bob Halley Date: Thu, 29 Sep 2005 05:12:48 +0000 (+0000) Subject: cope if time goes backwards a little bit X-Git-Tag: v1.3.5~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e616f41161050caec50672b04fb0299817e0b78f;p=thirdparty%2Fdnspython.git cope if time goes backwards a little bit --- diff --git a/ChangeLog b/ChangeLog index cbfc804e..88ec663d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ -2005-07-31 Bob Halley +2005-09-29 Bob Halley + + * dns/resolver.py (Resolver._compute_timeout): If time goes + backwards a little bit, ignore it. + +2005-07-31 Bob Halley * (Version 1.3.4 released) diff --git a/dns/resolver.py b/dns/resolver.py index 38e45d39..7433d4a3 100644 --- a/dns/resolver.py +++ b/dns/resolver.py @@ -427,8 +427,14 @@ class Resolver(object): def _compute_timeout(self, start): now = time.time() if now < start: - # Time going backwards is bad. Just give up. - raise Timeout + if start - now > 1: + # Time going backwards is bad. Just give up. + raise Timeout + else: + # Time went backwards, but only a little. This can + # happen, e.g. under vmware with older linux kernels. + # Pretend it didn't happen. + now = start duration = now - start if duration >= self.lifetime: raise Timeout