diff --git a/pool/base.php b/pool/base.php index e388a538..7c88113c 100644 --- a/pool/base.php +++ b/pool/base.php @@ -28,6 +28,54 @@ function dq($str) return str_replace('"', "\\\"", $str); } # +function daysago($val) +{ + if ($val < -13) + return ''; + + if ($val < 60) + $des = $val.'s'; + else + { + $val = round($val/6)/10; + if ($val < 60) + $des = $val.'min'; + else + { + $val = round($val/6)/10; + if ($val < 24) + { + $des = $val.'hr'; + if ($val != 1) + $des .= 's'; + } + else + { + $val = round($val/2.4)/10; + if ($val < 100) + { + $des = $val.'day'; + if ($val != 1) + $des .= 's'; + } + else + { + $val = round($val/0.7)/10; + if ($val < 10000) + { + $des = $val.'wk'; + if ($val != 1) + $des .= 's'; + } + else + $des = ''; + } + } + } + } + return $des; +} +# function howlongago($sec) { if ($sec < 60) diff --git a/pool/page_blocks.php b/pool/page_blocks.php index 68d04704..167f2999 100644 --- a/pool/page_blocks.php +++ b/pool/page_blocks.php @@ -93,6 +93,7 @@ function doblocks($data, $user) $pg .= "
Description | "; + $pg .= "Age | "; $pg .= "Diff% | "; $pg .= "Mean% | "; $pg .= "CDF[Erl] | "; @@ -108,6 +109,7 @@ function doblocks($data, $user) $row = 'odd'; $desc = $ans['s_desc:'.$i]; + $age = daysago($ans['STAMP'] - $ans['s_createdate:'.$i]); $diff = number_format(100 * $ans['s_diffratio:'.$i], 2); $mean = number_format(100 * $ans['s_diffmean:'.$i], 2); @@ -120,6 +122,7 @@ function doblocks($data, $user) $pg .= "
$desc Blocks | "; + $pg .= "$age | "; $pg .= "$diff% | "; $pg .= "$mean% | "; $pg .= "$cdferldsp | "; diff --git a/src/ckdb.h b/src/ckdb.h index c0f1eaec..b6cfd070 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -55,7 +55,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.2" -#define CKDB_VERSION DB_VERSION"-1.226" +#define CKDB_VERSION DB_VERSION"-1.227" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_cmd.c b/src/ckdb_cmd.c index 02ee883e..5f749d3f 100644 --- a/src/ckdb_cmd.c +++ b/src/ckdb_cmd.c @@ -1303,12 +1303,16 @@ redo: snprintf(tmp, sizeof(tmp), "s_seq:%d=%d%c" "s_desc:%d=%s%c" + "s_height:%d=%d%c" + "s_"CDTRF":%d=%ld%c" "s_diffratio:%d=%.8f%c" "s_diffmean:%d=%.8f%c" "s_cdferl:%d=%.8f%c" "s_luck:%d=%.8f%c", srows, seq, FLDSEP, srows, desc, FLDSEP, + srows, (int)(blocks->height), FLDSEP, + srows, blocks->createdate.tv_sec, FLDSEP, srows, blocks->diffratio, FLDSEP, srows, blocks->diffmean, FLDSEP, srows, blocks->cdferl, FLDSEP, @@ -1340,7 +1344,8 @@ redo: snprintf(tmp, sizeof(tmp), "s_rows=%d%cs_flds=%s%c", srows, FLDSEP, - "s_seq,s_desc,s_diffratio,s_diffmean,s_cdferl,s_luck", + "s_seq,s_desc,s_height,s_"CDTRF",s_diffratio,s_diffmean," + "s_cdferl,s_luck", FLDSEP); APPEND_REALLOC(buf, off, len, tmp);