mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Show date/time when proof-of-work is found.
This commit is contained in:
parent
1083e15c47
commit
4a7f3f70b5
14
cpu-miner.c
14
cpu-miner.c
@ -17,6 +17,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <time.h>
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#endif
|
#endif
|
||||||
@ -210,7 +211,11 @@ static void submit_work(CURL *curl, struct work *work)
|
|||||||
{
|
{
|
||||||
char *hexstr = NULL;
|
char *hexstr = NULL;
|
||||||
json_t *val, *res;
|
json_t *val, *res;
|
||||||
char s[345];
|
char s[345], timestr[64];
|
||||||
|
time_t now;
|
||||||
|
struct tm *tm;
|
||||||
|
|
||||||
|
now = time(NULL);
|
||||||
|
|
||||||
/* build hex string */
|
/* build hex string */
|
||||||
hexstr = bin2hex(work->data, sizeof(work->data));
|
hexstr = bin2hex(work->data, sizeof(work->data));
|
||||||
@ -236,8 +241,11 @@ static void submit_work(CURL *curl, struct work *work)
|
|||||||
|
|
||||||
res = json_object_get(val, "result");
|
res = json_object_get(val, "result");
|
||||||
|
|
||||||
printf("PROOF OF WORK RESULT: %s\n",
|
tm = localtime(&now);
|
||||||
json_is_true(res) ? "true (yay!!!)" : "false (booooo)");
|
strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S", tm);
|
||||||
|
|
||||||
|
printf("[%s] PROOF OF WORK RESULT: %s\n",
|
||||||
|
timestr, json_is_true(res) ? "true (yay!!!)" : "false (booooo)");
|
||||||
|
|
||||||
json_decref(val);
|
json_decref(val);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user