Browse Source

* Ported [2771] to 1.2.10
* Fixed cmd_trace to use 2 decimal places in display for seconds. (fixes #207)


svn: 2772

Bryan Drewery 20 năm trước cách đây
mục cha
commit
d6acdf9caa
3 tập tin đã thay đổi với 19 bổ sung3 xóa
  1. 1 0
      doc/UPDATES
  2. 10 2
      src/botcmd.c
  3. 8 1
      src/cmds.c

+ 1 - 0
doc/UPDATES

@@ -19,6 +19,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Fixed an invalid socket warning with failed relay. (fixes #216)
 * Fixed a potential dns socket leak. (might fix #230)
 * Fixed leaf bots sending color to hub bots still. (fixes #161)
+* Fixed cmd_trace to use 2 decimal places in display for seconds. (fixes #207)
 
 1.2.9
 * Fixed cmd_[un]stick not properly using numbers for channel masks. (#160)

+ 10 - 2
src/botcmd.c

@@ -26,6 +26,7 @@
 #include "users.h"
 #include "chan.h"
 #include "core_binds.h"
+#include "egg_timer.h"
 
 static char TBUF[1024] = "";		/* Static buffer for goofy bot stuff */
 
@@ -749,8 +750,15 @@ static void bot_traced(int idx, char *par)
             register char *c=p;
             for (; *c != '\0'; c++) if (*c == ':') j++;
           }
-         dprintf(i, "%s -> %s (%lu secs, %d hop%s)\n", BOT_TRACERESULT, p2,
-            now - t, j, (j != 1) ? "s" : "");
+
+         time_t tm;
+         egg_timeval_t tv;
+
+         timer_get_now(&tv);
+         tm = ((tv.sec % 10000) * 100 + (tv.usec * 100) / (1000000)) - t;
+
+         dprintf(i, "%s -> %s (%li.%li secs, %d hop%s)\n", BOT_TRACERESULT, p2,
+            (tm / 100), (tm % 100), j, (j != 1) ? "s" : "");
 	} else
 	  dprintf(i, "%s -> %s\n", BOT_TRACERESULT, p);
       }

+ 8 - 1
src/cmds.c

@@ -2060,7 +2060,14 @@ static void cmd_trace(int idx, char *par)
 
   putlog(LOG_CMDS, "*", "#%s# trace %s", dcc[idx].nick, par);
   simple_sprintf(x, "%d:%s@%s", dcc[idx].sock, dcc[idx].nick, conf.bot->nick);
-  sprintf(y, ":%li", now);
+
+  time_t tm;
+  egg_timeval_t tv;
+
+  timer_get_now(&tv);
+  tm = (tv.sec % 10000) * 100 + (tv.usec * 100) / (1000000);
+
+  sprintf(y, ":%li", tm);
   botnet_send_trace(i, x, par, y);
 }