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

View File

@ -1,9 +1,12 @@
# vim:fileencoding=utf-8 # 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'] monotonicp, err = plugins['monotonic']
if err: if err:
raise RuntimeError('Failed to load the monotonic module with error: ' + err) raise RuntimeError('Failed to load the monotonic module with error: ' + err)
monotonic = monotonicp.monotonic monotonic = monotonicp.monotonic
del monotonicp, err del monotonicp, err