systemd-python: _reader now takes unix timestamp in seconds

This commit is contained in:
Steven Hiscocks
2013-02-22 16:57:44 +01:00
committed by Zbigniew Jędrzejewski-Szmek
parent 83718af6f5
commit 518dc5dff5
2 changed files with 7 additions and 4 deletions
+6 -3
View File
@@ -336,14 +336,17 @@ Journal_seek(Journal *self, PyObject *args, PyObject *keywds)
PyDoc_STRVAR(Journal_seek_realtime__doc__,
"seek_realtime(realtime) -> None\n\n"
"Seek to nearest matching journal entry to `realtime`. Argument\n"
"`realtime` can must be an integer unix timestamp in usecs.");
"`realtime` can must be an integer unix timestamp.");
static PyObject *
Journal_seek_realtime(Journal *self, PyObject *args)
{
uint64_t timestamp;
if (! PyArg_ParseTuple(args, "K", &timestamp))
double timedouble;
if (! PyArg_ParseTuple(args, "d", &timedouble))
return NULL;
uint64_t timestamp;
timestamp = (uint64_t) (timedouble * 1.0E6);
if ((int64_t) timestamp < 0LL) {
PyErr_SetString(PyExc_ValueError, "Time must be positive integer");
return NULL;