From cc05128ae3fc9f9d70f68085c9623d22c81b1dee Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Fri, 14 Nov 2014 20:30:42 +0100 Subject: [PATCH] api: fix histo thread param --- api.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/api.cpp b/api.cpp index 16449ec..e4bdbff 100644 --- a/api.cpp +++ b/api.cpp @@ -205,19 +205,15 @@ static char *getstats(char *params) static char *gethistory(char *params) { struct stats_data data[20]; - int thr = atoi(params ? params : "-1"); + int thr = params ? atoi(params) : -1; char *p = buffer; - if (!thr) - thr = -1; *buffer = '\0'; int records = stats_get_history(thr, data, ARRAY_SIZE(data)); for (int i = 0; i < records; i++) { - char time[16]; time_t ts = data[i].tm_stat; - time2str(time, ts); - p += sprintf(p, "GPU=%d;KHS=%.2f;DIFF=%.6f;COUNT=%u;FOUND=%u;TS=%u;TIME=%s|", + p += sprintf(p, "GPU=%d;KHS=%.2f;DIFF=%.6f;COUNT=%u;FOUND=%u;TS=%u|", data[i].gpu_id, data[i].hashrate, data[i].difficulty, data[i].hashcount, - data[i].hashfound, (uint32_t)ts, time); + data[i].hashfound, (uint32_t)ts); } return buffer; } @@ -508,14 +504,17 @@ static void api() } buf[n] = '\0'; - if (opt_debug && opt_protocol && n > 0) - applog(LOG_DEBUG, "API: recv command: (%d) '%s'+char(%x)", n, buf, buf[n-1]); + //if (opt_debug && opt_protocol && n > 0) + // applog(LOG_DEBUG, "API: recv command: (%d) '%s'+char(%x)", n, buf, buf[n-1]); if (!fail) { params = strchr(buf, '|'); if (params != NULL) *(params++) = '\0'; + if (opt_debug && opt_protocol && n > 0) + applog(LOG_DEBUG, "API: exec command %s(%s)", buf, params); + for (i = 0; i < CMDMAX; i++) { if (strcmp(buf, cmds[i].name) == 0) { result = (cmds[i].func)(params);