Browse Source

Bugfix: Replace block_timeval with (time_t) block_time

Luke Dashjr 12 years ago
parent
commit
37e0753cbd
3 changed files with 7 additions and 7 deletions
  1. 3 3
      api.c
  2. 3 3
      miner.c
  3. 1 1
      miner.h

+ 3 - 3
api.c

@@ -2844,11 +2844,11 @@ static void minecoin(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __may
 
 	cg_rlock(&ch_lock);
 	if (current_fullhash && *current_fullhash) {
-		root = api_add_timeval(root, "Current Block Time", &block_timeval, true);
+		root = api_add_time(root, "Current Block Time", &block_time, true);
 		root = api_add_string(root, "Current Block Hash", current_fullhash, true);
 	} else {
-		struct timeval t = {0,0};
-		root = api_add_timeval(root, "Current Block Time", &t, true);
+		time_t t = 0;
+		root = api_add_time(root, "Current Block Time", &t, true);
 		root = api_add_const(root, "Current Block Hash", BLANK, false);
 	}
 	cg_runlock(&ch_lock);

+ 3 - 3
miner.c

@@ -292,7 +292,7 @@ char *current_fullhash;
 
 static char datestamp[40];
 static char blocktime[32];
-struct timeval block_timeval;
+time_t block_time;
 static char best_share[8] = "0";
 double current_diff = 0xFFFFFFFFFFFFFFFFULL;
 static char block_diff[8];
@@ -4865,12 +4865,12 @@ static void set_curblock(char *hexstr, unsigned char *hash)
 	swap32tole(hash_swap, hash_swap, 32 / 4);
 
 	cg_wlock(&ch_lock);
-	cgtime(&block_timeval);
+	block_time = time(NULL);
 	__update_block_title(hash_swap);
 	free(current_fullhash);
 	current_fullhash = malloc(65);
 	bin2hex(current_fullhash, hash_swap, 32);
-	get_timestamp(blocktime, block_timeval.tv_sec);
+	get_timestamp(blocktime, block_time);
 	cg_wunlock(&ch_lock);
 
 	applog(LOG_INFO, "New block: %s diff %s (%s)", current_hash, block_diff, net_hashrate);

+ 1 - 1
miner.h

@@ -1000,7 +1000,7 @@ extern unsigned long long global_hashrate;
 extern char *current_fullhash;
 extern double current_diff;
 extern uint64_t best_diff;
-extern struct timeval block_timeval;
+extern time_t block_time;
 
 #ifdef HAVE_OPENCL
 typedef struct {