Skip to content

Commit

Permalink
loginctl: list-sessions: fix timestamp for idle hint
Browse files Browse the repository at this point in the history
Follow-up for 556723e

TABLE_TIMESTAMP_RELATIVE takes a realtime timestamp.
  • Loading branch information
YHNdnzj committed May 24, 2023
1 parent c944339 commit be88af3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/login/loginctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ typedef struct SessionStatusInfo {
const char *scope;
const char *desktop;
bool idle_hint;
dual_timestamp idle_hint_timestamp;
usec_t idle_hint_timestamp;
} SessionStatusInfo;

typedef struct UserStatusInfo {
Expand Down Expand Up @@ -172,11 +172,11 @@ static int show_table(Table *table, const char *word) {

static int list_sessions(int argc, char *argv[], void *userdata) {

static const struct bus_properties_map map[] = {
{ "IdleHint", "b", NULL, offsetof(SessionStatusInfo, idle_hint) },
{ "IdleSinceHintMonotonic", "t", NULL, offsetof(SessionStatusInfo, idle_hint_timestamp.monotonic) },
{ "State", "s", NULL, offsetof(SessionStatusInfo, state) },
{ "TTY", "s", NULL, offsetof(SessionStatusInfo, tty) },
static const struct bus_properties_map map[] = {
{ "IdleHint", "b", NULL, offsetof(SessionStatusInfo, idle_hint) },
{ "IdleSinceHint", "t", NULL, offsetof(SessionStatusInfo, idle_hint_timestamp) },
{ "State", "s", NULL, offsetof(SessionStatusInfo, state) },
{ "TTY", "s", NULL, offsetof(SessionStatusInfo, tty) },
{},
};

Expand Down Expand Up @@ -240,7 +240,7 @@ static int list_sessions(int argc, char *argv[], void *userdata) {
return table_log_add_error(r);

if (i.idle_hint)
r = table_add_cell(table, NULL, TABLE_TIMESTAMP_RELATIVE, &i.idle_hint_timestamp.monotonic);
r = table_add_cell(table, NULL, TABLE_TIMESTAMP_RELATIVE, &i.idle_hint_timestamp);
else
r = table_add_cell(table, NULL, TABLE_EMPTY, NULL);
if (r < 0)
Expand Down

0 comments on commit be88af3

Please sign in to comment.