[Initng-svn] r3007 - initng/plugins/ngc2

svn at initng.thinktux.net svn at initng.thinktux.net
Thu Feb 16 21:43:29 CET 2006


Author: deac
Date: Thu Feb 16 21:43:28 2006
New Revision: 3007

Modified:
   initng/plugins/ngc2/ngc2.c
Log:
ngc2.c: years in seconds are unreadable. so calculate it in s, m, h, d.

Modified: initng/plugins/ngc2/ngc2.c
==============================================================================
--- initng/plugins/ngc2/ngc2.c	(original)
+++ initng/plugins/ngc2/ngc2.c	Thu Feb 16 21:43:28 2006
@@ -841,10 +841,24 @@
     {
         struct tm *ts = localtime(&row.t.tv_sec);
         int tbuf = MS_DIFF(now, row.t) / 1000;
+		char tch = 's';
+		if( tbuf > 60) {
+			tbuf /= 60;
+			if( tbuf > 60) {
+				tbuf /= 60;
+				if( tbuf > 24) {
+					tbuf /= 24;
+					tch = 'd';
+				}
+				else
+					tch = 'h'
+			}
+			else
+				tch = 'm';
+		}
 
         print_out("%.2i:%.2i:%.2i %-38s :%-22s %7i%c\n",
-                  ts->tm_hour, ts->tm_min, ts->tm_sec, row.n, row.s,
-                  tbuf > 60 ? tbuf / 60 : tbuf, tbuf > 60 ? 'm' : 's');
+                  ts->tm_hour, ts->tm_min, ts->tm_sec, row.n, row.s, tbuf, tch);
 
     }
     close_socket();


More information about the Initng-svn mailing list