summaryrefslogtreecommitdiff
path: root/src/python-systemd/journal.py
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-02-23 01:11:36 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-02-28 20:04:17 -0500
commit86e3d32a1d52cd2ccba184e8375da8828914d3ff (patch)
tree9b200f35105c4831de286f708a3c071cc7f71314 /src/python-systemd/journal.py
parent6a6633a16a510b40c6ad30cd0858699619384a44 (diff)
systemd-python: return both parts of sd_journal_get_monotonic_usec
In Python 3, a named tuple is used. In Python 2, a simple tuple is used. In either case, the pair is (timestamp, bootid).
Diffstat (limited to 'src/python-systemd/journal.py')
-rw-r--r--src/python-systemd/journal.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/python-systemd/journal.py b/src/python-systemd/journal.py
index d94934cfa8..a5641e98b2 100644
--- a/src/python-systemd/journal.py
+++ b/src/python-systemd/journal.py
@@ -38,7 +38,13 @@ from ._reader import (_Journal, NOP, APPEND, INVALIDATE,
LOCAL_ONLY, RUNTIME_ONLY, SYSTEM_ONLY)
from . import id128 as _id128
-_MONOTONIC_CONVERTER = lambda x: _datetime.timedelta(microseconds=x)
+if _sys.version_info >= (3,):
+ from ._reader import Monotonic
+else:
+ Monotonic = tuple
+
+_MONOTONIC_CONVERTER = lambda p: Monotonic((_datetime.timedelta(microseconds=p[0]),
+ _uuid.UUID(bytes=p[1])))
_REALTIME_CONVERTER = lambda x: _datetime.datetime.fromtimestamp(x / 1E6)
DEFAULT_CONVERTERS = {
'MESSAGE_ID': _uuid.UUID,