--- loncom/lond	2020/05/04 17:08:26	1.489.2.37
+++ loncom/lond	2020/05/05 20:28:56	1.489.2.38
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.489.2.37 2020/05/04 17:08:26 raeburn Exp $
+# $Id: lond,v 1.489.2.38 2020/05/05 20:28:56 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -63,7 +63,7 @@ my $DEBUG = 0;		       # Non zero to ena
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.489.2.37 $'; #' stupid emacs
+my $VERSION='$Revision: 1.489.2.38 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid="default";
 my $currentdomainid;
@@ -4593,11 +4593,10 @@ sub course_sessions_handler {
                 my ($uname,$udom) = ($1,$2);
                 next unless (-e "$perlvar{'lonDaemons'}/tmp/$uname$dbsuffix");
                 my $mtime = (stat("$perlvar{'lonIDsDir'}/$filename"))[9];
-                my $since=$now-$mtime;
                 if ($lastactivity < 0) {
-                    next if ($since <= $lastactivity);
+                    next if ($mtime-$now > $lastactivity);
                 } else {
-                    next if ($since > $lastactivity);
+                    next if ($now-$mtime > $lastactivity);
                 }
                 $sessions{$uname.':'.$udom} = $mtime;
             }