summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-11-18 13:26:28 +0100
committerSimon Rettberg2019-11-18 13:26:28 +0100
commitd352f73c2ffb079012ed16b455bb4dbeb3a43177 (patch)
treea02d544b45803ce12e011b823eed41021c7bfd0f
parentDon't poll .no-saver if dpms and screen saver are disabled (diff)
downloadidle-daemon-d352f73c2ffb079012ed16b455bb4dbeb3a43177.tar.gz
idle-daemon-d352f73c2ffb079012ed16b455bb4dbeb3a43177.tar.xz
idle-daemon-d352f73c2ffb079012ed16b455bb4dbeb3a43177.zip
rpc: Account for wall clock changes
-rw-r--r--src/rpc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/rpc.c b/src/rpc.c
index e63f7fe..9345876 100644
--- a/src/rpc.c
+++ b/src/rpc.c
@@ -176,11 +176,12 @@ static void handleClient( int fd, struct ucred *creds )
while ( tok != NULL ) {
struct user *user = main_getUser( tok );
if ( user != NULL ) {
+ const int idleTime = (int)( time( NULL ) - ( user->lastActivity + user->lastActivityOffset ) );
fprintf( s, "[%s]\n"
"logoutTime=%lld\n"
"locked=%d\n"
"idleSeconds=%d\n",
- tok, (long long)user->logoutTime, (int)user->isLocked, (int)( time(NULL) - user->lastActivity ) );
+ tok, (long long)user->logoutTime, (int)user->isLocked, idleTime );
}
tok = strtok( NULL, " \t\n\r" );
}