Browse Source

ckdb/php - add/show block find time to blocklist

master
kanoi 10 years ago
parent
commit
bf602d4a18
  1. 2
      pool/page_blocks.php
  2. 13
      src/ckdb.c

2
pool/page_blocks.php

@ -36,7 +36,7 @@ function doblocks($data, $user)
$pg .= "<td class=dl$ex>".$ans['height'.$i].'</td>'; $pg .= "<td class=dl$ex>".$ans['height'.$i].'</td>';
$pg .= "<td class=dl$ex>".$ans['workername'.$i].'</td>'; $pg .= "<td class=dl$ex>".$ans['workername'.$i].'</td>';
$pg .= "<td class=dr$ex>".btcfmt($ans['reward'.$i]).'</td>'; $pg .= "<td class=dr$ex>".btcfmt($ans['reward'.$i]).'</td>';
$pg .= "<td class=dl$ex>".gmdate('Y-m-d H:i:s+00', $ans['createdate'.$i]).'</td>'; $pg .= "<td class=dl$ex>".gmdate('Y-m-d H:i:s+00', $ans['firstcreatedate'.$i]).'</td>';
$pg .= "<td class=dr$ex>".$stat.'</td>'; $pg .= "<td class=dr$ex>".$stat.'</td>';
$pg .= "</tr>\n"; $pg .= "</tr>\n";
} }

13
src/ckdb.c

@ -47,7 +47,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "0.8" #define DB_VERSION "0.8"
#define CKDB_VERSION DB_VERSION"-0.200" #define CKDB_VERSION DB_VERSION"-0.201"
#define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__ #define WHERE_FFL_HERE __FILE__, __func__, __LINE__
@ -7256,6 +7256,8 @@ static char *cmd_blocklist(__maybe_unused PGconn *conn, char *cmd, char *id,
char tmp[1024]; char tmp[1024];
char *buf; char *buf;
size_t len, off; size_t len, off;
int32_t height = -1;
tv_t first_cd = {0,0};
int rows; int rows;
LOGDEBUG("%s(): cmd '%s'", __func__, cmd); LOGDEBUG("%s(): cmd '%s'", __func__, cmd);
@ -7266,6 +7268,10 @@ static char *cmd_blocklist(__maybe_unused PGconn *conn, char *cmd, char *id,
K_RLOCK(blocks_free); K_RLOCK(blocks_free);
b_item = last_in_ktree(blocks_root, ctx); b_item = last_in_ktree(blocks_root, ctx);
while (b_item && rows < 42) { while (b_item && rows < 42) {
if (height != DATA_BLOCKS(b_item)->height) {
height = DATA_BLOCKS(b_item)->height;
copy_tv(&first_cd, &(DATA_BLOCKS(b_item)->createdate));
}
if (CURRENT(&(DATA_BLOCKS(b_item)->expirydate))) { if (CURRENT(&(DATA_BLOCKS(b_item)->expirydate))) {
int_to_buf(DATA_BLOCKS(b_item)->height, reply, sizeof(reply)); int_to_buf(DATA_BLOCKS(b_item)->height, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "height%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "height%d=%s%c", rows, reply, FLDSEP);
@ -7287,6 +7293,11 @@ static char *cmd_blocklist(__maybe_unused PGconn *conn, char *cmd, char *id,
snprintf(tmp, sizeof(tmp), "workername%d=%s%c", rows, reply, FLDSEP); snprintf(tmp, sizeof(tmp), "workername%d=%s%c", rows, reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp),
"firstcreatedate%d=%ld%c", rows,
first_cd.tv_sec, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), snprintf(tmp, sizeof(tmp),
"createdate%d=%ld%c", rows, "createdate%d=%ld%c", rows,
DATA_BLOCKS(b_item)->createdate.tv_sec, FLDSEP); DATA_BLOCKS(b_item)->createdate.tv_sec, FLDSEP);

Loading…
Cancel
Save