Use builtin monotonic in py3

This commit is contained in:
Flaviu Tamas 2018-09-14 13:19:34 -04:00
parent 8785619938
commit 82377cb1c4
2 changed files with 13 additions and 7 deletions

View File

@ -168,7 +168,6 @@ class Plugins(collections.Mapping):
'chm_extra',
'icu',
'speedup',
'monotonic',
'unicode_names',
'zlib2',
'html',
@ -183,6 +182,10 @@ class Plugins(collections.Mapping):
'certgen',
'lzma_binding',
]
if not ispy3:
plugins.extend([
'monotonic',
])
if iswindows:
plugins.extend(['winutil', 'wpd', 'winfonts'])
if isosx:

View File

@ -1,9 +1,12 @@
# vim:fileencoding=utf-8
from calibre.constants import plugins
try:
from time import monotonic
except ImportError:
from calibre.constants import plugins
monotonicp, err = plugins['monotonic']
if err:
raise RuntimeError('Failed to load the monotonic module with error: ' + err)
monotonic = monotonicp.monotonic
del monotonicp, err
monotonicp, err = plugins['monotonic']
if err:
raise RuntimeError('Failed to load the monotonic module with error: ' + err)
monotonic = monotonicp.monotonic
del monotonicp, err