static int get_last_trigger(
sd_bus *bus,
const char *path,
- usec_t *last) {
+ dual_timestamp *last) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
+ dual_timestamp t;
int r;
assert(bus);
"LastTriggerUSec",
&error,
't',
- last);
+ &t.realtime);
+ if (r < 0)
+ return log_error_errno(r, "Failed to get last trigger time: %s", bus_error_message(&error, r));
+
+ r = sd_bus_get_property_trivial(
+ bus,
+ "org.freedesktop.systemd1",
+ path,
+ "org.freedesktop.systemd1.Timer",
+ "LastTriggerUSecMonotonic",
+ &error,
+ 't',
+ &t.monotonic);
if (r < 0)
return log_error_errno(r, "Failed to get last trigger time: %s", bus_error_message(&error, r));
+ *last = t;
return 0;
}
const char* machine;
const char* id;
usec_t next_elapse;
- usec_t last_trigger;
+ dual_timestamp last_trigger;
char **triggered;
} TimerInfo;
r = table_add_many(table,
TABLE_TIMESTAMP, t->next_elapse,
TABLE_TIMESTAMP_LEFT, t->next_elapse,
- TABLE_TIMESTAMP, t->last_trigger,
- TABLE_TIMESTAMP_RELATIVE, t->last_trigger,
+ TABLE_TIMESTAMP, t->last_trigger.realtime,
+ TABLE_TIMESTAMP_RELATIVE_MONOTONIC, t->last_trigger.monotonic,
TABLE_STRING, unit);
if (r < 0)
return table_log_add_error(r);
size_t *n_timers) {
_cleanup_strv_free_ char **triggered = NULL;
- dual_timestamp next = DUAL_TIMESTAMP_NULL;
- usec_t m, last = 0;
+ dual_timestamp next, last;
+ usec_t m;
int r;
assert(bus);