cysystemd icon indicating copy to clipboard operation
cysystemd copied to clipboard

get_realtime_sec() freezes in reader.JournalReader

Open poreklo opened this issue 6 years ago • 1 comments

When used cysystemd.reader.JournalReader a problem occurs. get_monotonic_sec() works correctly and time updated at every line. But get_realtime_sec() freeze for 128 seconds.

Test script:

#!/usr/bin/env python3

from cysystemd.reader import JournalOpenMode, JournalReader, Rule
import time

if __name__ == '__main__':
    j = JournalReader()
    j.open(JournalOpenMode.SYSTEM)
    j.seek_realtime_usec(time.time() * 1000000)
    while True:
        j.wait(1)
        for entry in j:
            print("date = {}, monotonic = {}, realtime = {}".format(
                entry.date, entry.get_monotonic_sec(), entry.get_realtime_sec()
))

and output:

date = 2019-02-22 05:26:24, monotonic = 1909098.0, realtime = 1550813184.0. Diff = 1548904086.0
date = 2019-02-22 05:26:24, monotonic = 1909099.0, realtime = 1550813184.0. Diff = 1548904085.0
date = 2019-02-22 05:26:24, monotonic = 1909099.0, realtime = 1550813184.0. Diff = 1548904085.0
date = 2019-02-22 05:26:24, monotonic = 1909099.0, realtime = 1550813184.0. Diff = 1548904085.0
date = 2019-02-22 05:26:24, monotonic = 1909099.0, realtime = 1550813184.0. Diff = 1548904085.0
date = 2019-02-22 05:26:24, monotonic = 1909102.0, realtime = 1550813184.0. Diff = 1548904082.0
date = 2019-02-22 05:26:24, monotonic = 1909103.0, realtime = 1550813184.0. Diff = 1548904081.0
date = 2019-02-22 05:26:24, monotonic = 1909104.0, realtime = 1550813184.0. Diff = 1548904080.0
date = 2019-02-22 05:26:24, monotonic = 1909104.0, realtime = 1550813184.0. Diff = 1548904080.0
date = 2019-02-22 05:26:24, monotonic = 1909105.0, realtime = 1550813184.0. Diff = 1548904079.0
date = 2019-02-22 05:28:32, monotonic = 1909106.0, realtime = 1550813312.0. Diff = 1548904206.0
date = 2019-02-22 05:28:32, monotonic = 1909107.0, realtime = 1550813312.0. Diff = 1548904205.0
date = 2019-02-22 05:28:32, monotonic = 1909107.0, realtime = 1550813312.0. Diff = 1548904205.0
date = 2019-02-22 05:28:32, monotonic = 1909107.0, realtime = 1550813312.0. Diff = 1548904205.0
date = 2019-02-22 05:28:32, monotonic = 1909108.0, realtime = 1550813312.0. Diff = 1548904204.0

I tested this script with Debian 9 (Python 3.5) and Ubuntu 18.04 (Python 3.6)

poreklo avatar Feb 22 '19 06:02 poreklo

Is it reproduces right now?

mosquito avatar Jun 15 '23 12:06 mosquito