diff --git a/setup.py b/setup.py index 02e9064e2..b4ff8ebc3 100644 --- a/setup.py +++ b/setup.py @@ -267,5 +267,10 @@ if sys.version_info < (3, 0): 'bug at and we\'ll ' 'see together what we can do about it.', DeprecationWarning) +if sys.version_info < (3, 3): + warnings.warn('You are installing Limnoria for Python < 3.3, which is ' + 'only partially support. Limnoria requires Python 3.4 or later ' + 'to be fully stable.', + DeprecationWarning) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/src/registry.py b/src/registry.py index c37bf0312..1208ef2e1 100644 --- a/src/registry.py +++ b/src/registry.py @@ -70,6 +70,12 @@ ENCODING = 'string_escape' if minisix.PY2 else 'unicode_escape' decoder = codecs.getdecoder(ENCODING) encoder = codecs.getencoder(ENCODING) +if hasattr(time, 'monotonic'): + monotonic_time = time.monotonic +else: + # fallback for python < 3.3 + monotonic_time = time.time + _cache = utils.InsensitivePreservingDict() _lastModified = 0 def open_registry(filename, clear=False): @@ -105,7 +111,7 @@ def open_registry(filename, clear=False): except ValueError: raise InvalidRegistryFile('Error unpacking line %r' % acc) _cache[key] = value - _lastModified = time.time() + _lastModified = monotonic_time() _fd.close() CONF_FILE_HEADER = """ @@ -435,7 +441,7 @@ class Value(Group): if self._name == 'unset': self._lastModified = 0 self.__parent.setName(*args) - self._lastModified = time.time() + self._lastModified = monotonic_time() def set(self, s): """Override this with a function to convert a string to whatever type @@ -456,7 +462,7 @@ class Value(Group): inherited=True means the value is inherited from the parent, so if the parent gets a new value, this group will get the new value as well.""" - self._lastModified = time.time() + self._lastModified = monotonic_time() self.value = v if self._supplyDefault: for (name, child) in list(self._children.items()): diff --git a/src/test.py b/src/test.py index 820ae978b..1127e71ac 100644 --- a/src/test.py +++ b/src/test.py @@ -87,7 +87,6 @@ def timeFastForward(extra_offset): mock_time_offset += extra_offset def setupMockTime(): - mock_time_offset = 0 time.time = mockTime def teardownMockTime():