- def query_unique(self, key):
- return set(self._convert_field(key, value)
- for value in super(Journal, self).query_unique(key))
-
- def seek_realtime(self, timestamp):
- if isinstance(timestamp, datetime.datetime):
- timestamp = int(timestamp.strftime("%s%f"))
- return super(Journal, self).seek_realtime(timestamp)
-
- def seek_monotonic(self, timestamp, bootid=None):
- if isinstance(timestamp, datetime.timedelta):
- timestamp = timestamp.totalseconds()
- return super(Journal, self).seek_monotonic(timestamp, bootid)
+ def query_unique(self, field):
+ """Returns a set of unique values in journal for given `field`,
+ processed with converters.
+ Note this does not respect any journal matches."""
+ return set(self._convert_field(field, value)
+ for value in super(Journal, self).query_unique(field))
+
+ def seek_realtime(self, realtime):
+ """Seek to nearest matching journal entry to `realtime`.
+ Argument `realtime` can must be either an integer unix timestamp
+ or datetime.datetime instance."""
+ if isinstance(realtime, _datetime.datetime):
+ realtime = float(realtime.strftime("%s.%f"))
+ return super(Journal, self).seek_realtime(realtime)
+
+ def seek_monotonic(self, monotonic, bootid=None):
+ """Seek to nearest matching journal entry to `monotonic`.
+ Argument `monotonic` is a timestamp from boot in either seconds
+ or a datetime.timedelta instance.
+ Argument `bootid` is a string or UUID representing which boot the
+ monotonic time is reference to. Defaults to current bootid."""
+ if isinstance(monotonic, _datetime.timedelta):
+ monotonic = monotonic.totalseconds()
+ if isinstance(bootid, _uuid.UUID):
+ bootid = bootid.get_hex()
+ return super(Journal, self).seek_monotonic(monotonic, bootid)