From f608ed3b81e73b976d1cd0abd64a139cfbc442d8 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Sun, 17 Apr 2016 18:05:42 +0800 Subject: [PATCH] dev of mixins_time_scale method started --- src/page.h | 37 +++++++++++++++++++++++++++++++++++++ src/templates/block.html | 4 ++-- src/templates/index.html | 4 ++-- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/page.h b/src/page.h index 56968df..4cf6ba2 100644 --- a/src/page.h +++ b/src/page.h @@ -543,6 +543,43 @@ namespace xmreg { return txd; } + string + mixins_time_scale(const vector& timestamps) + { + string empty_time = string("___________________________________") + + string("___________________________________") + + string("___________________________________") + + string("___________________________________"); + + size_t time_axis_length = empty_time.size(); + + cout << "time_axis_length: " << time_axis_length << endl; + + uint64_t time0 = 10; + uint64_t timeN = 30; + + uint64_t interval_length = timeN-time0; + + double scale = double(interval_length) / double(time_axis_length); + + for (const auto& timestamp: timestamps) + { + + if (timestamp < time0 || timestamp > timeN) + { + cout << "Out of range" << endl; + continue; + } + + uint64_t timestamp_place = double(timestamp-time0)/double(interval_length)*(time_axis_length-1); + //cout << timestamp_place << endl; + empty_time[timestamp_place] = '*'; + } + + return string("Genesis ") + empty_time + string(" Now"); + } + + pair get_age(uint64_t timestamp1, uint64_t timestamp2) { diff --git a/src/templates/block.html b/src/templates/block.html index 33284c0..33db1d9 100644 --- a/src/templates/block.html +++ b/src/templates/block.html @@ -58,7 +58,7 @@ - + @@ -67,7 +67,7 @@ {{#blk_txs}} - + diff --git a/src/templates/index.html b/src/templates/index.html index cf63c01..68d5b45 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -31,7 +31,7 @@ - + @@ -42,7 +42,7 @@ - +
hashinputs/outputsoutputs fee mixin no size [kB]
{{hash}}{{sum_inputs}}/{{sum_outputs}}{{sum_outputs}} {{tx_fee}} {{mixin}} {{tx_size}}block hash reward/fees txsinputs/outputsoutputs mixins size [kB]
{{hash}} {{block_reward}} {{notx}}{{xmr_inputs}}/{{xmr_outputs}}{{xmr_outputs}} {{mixin_range}} {{blksize}}