diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-02-22 13:33:06 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-02-28 20:04:17 -0500 |
commit | 6a6633a16a510b40c6ad30cd0858699619384a44 (patch) | |
tree | 0fdf50a3cd3e478e7df9a5d30298fb4f2087a965 /src/python-systemd/journal.py | |
parent | d426d8c8632ba0be408f8b6b56514b4598abab74 (diff) |
python-systemd: check all errors and use automatic cleanup
__REALTIME_TIMESTAMP and __MONOTONIC_TIMESTAMP return ints.
It doesn't make sense to convert to string, just to convert
back to a number later on.
Also try to follow systemd rules for indentation.
Diffstat (limited to 'src/python-systemd/journal.py')
-rw-r--r-- | src/python-systemd/journal.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/python-systemd/journal.py b/src/python-systemd/journal.py index 4d71564c65..d94934cfa8 100644 --- a/src/python-systemd/journal.py +++ b/src/python-systemd/journal.py @@ -19,6 +19,8 @@ # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. +from __future__ import division + import sys as _sys import datetime as _datetime import functools as _functools @@ -36,8 +38,8 @@ 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=float(x)) -_REALTIME_CONVERTER = lambda x: _datetime.datetime.fromtimestamp(float(x)/1E6) +_MONOTONIC_CONVERTER = lambda x: _datetime.timedelta(microseconds=x) +_REALTIME_CONVERTER = lambda x: _datetime.datetime.fromtimestamp(x / 1E6) DEFAULT_CONVERTERS = { 'MESSAGE_ID': _uuid.UUID, '_MACHINE_ID': _uuid.UUID, |