summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2018-06-13 16:23:54 +0200
committerLubomir Rintel <lkundrak@v3.sk>2018-06-14 17:30:06 +0200
commit119e828dbeeeab134e83890b18d0b7a0c1838786 (patch)
treebebb681aeb419e1e8fdb1b78f0fab1b77c158e09 /examples
parent9a14f9caa59d2853a338e5935355dcb611cf170f (diff)
example/python: avoid falling back to CLOCK_MONOTONIC
According to the D-Bus API specification we return CLOCK_BOOTTIME only. We don't support kernels too old to have it -- the fall back to CLOCK_MONOTONIC is only there to be able to run unit tests on RHEL 6 kernel and will eventually go away.
Diffstat (limited to 'examples')
-rw-r--r--examples/python/nmex.py14
1 files changed, 2 insertions, 12 deletions
diff --git a/examples/python/nmex.py b/examples/python/nmex.py
index a85eecaf8..78489efeb 100644
--- a/examples/python/nmex.py
+++ b/examples/python/nmex.py
@@ -50,18 +50,8 @@ def sys_clock_gettime_ns(clock_id):
return _sys_clock_gettime_ns(clock_id)
def nm_boot_time_ns():
- # NetworkManager exposes some timestamps as CLOCK_BOOTTIME.
- # Try that first (number 7).
- try:
- return sys_clock_gettime_ns(7)
- except OSError as e:
- # On systems, where this is not available, fallback to
- # CLOCK_MONOTONIC (numeric 1).
- # That is what NetworkManager does as well.
- import errno
- if e.errno == errno.EINVAL:
- return sys_clock_gettime_ns(1)
- raise
+ CLOCK_BOOTTIME = 7
+ return sys_clock_gettime_ns(CLOCK_BOOTTIME)
def nm_boot_time_us():
return nm_boot_time_ns() / 1000
def nm_boot_time_ms():