]> skyeroc.xyz Git - dgamelaunch/commitdiff
Fix idletime display.
authorPasi Kallinen <paxed@alt.org>
Sat, 1 May 2010 15:30:04 +0000 (15:30 +0000)
committerPasi Kallinen <paxed@alt.org>
Sat, 1 May 2010 15:30:04 +0000 (15:30 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@538 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

dgamelaunch.c

index 434628db81758bf79dd6864097b29976bda16c01..e81ce1704c4fbd532c0690f96843d7737a9a3236 100644 (file)
@@ -674,10 +674,14 @@ inprogressmenu (int gameid)
 #endif
          {
              time_t ctime;
+             long secs, mins, hours;
+
              (void) time(&ctime);
-             long secs = (ctime - games[i + offset]->idle_time) % 60;
-             long mins = (ctime - games[i + offset]->idle_time) / 60;
-             long hours= (ctime - games[i + offset]->idle_time) / (60*60);
+             secs = (ctime - games[i + offset]->idle_time);
+             hours = (secs / 3600);
+             secs -= (hours * 3600);
+             mins = (secs / 60) % 60;
+             secs -= (mins*60);
              if (hours)
                  snprintf(idletime, 10, "%ldh %ldm", hours, mins);
              else