resolution info added to time scale

master
moneroexamples 9 years ago
parent df4a9b9f3f
commit 1f7eede2b6

@ -582,6 +582,7 @@ namespace xmreg {
mstch::array inputs = mstch::array{};
mstch::array mixins_timescales;
double timescale_scale {0.0}; // size of one '_' in days
// make timescale maps for mixins in input
for (const txin_to_key& in_key: txd.input_key_imgs)
@ -651,19 +652,25 @@ namespace xmreg {
}
// get mixins in time scale for visual representation
string mixin_times_scale = xmreg::timestamps_time_scale(mixin_timestamps,
server_timestamp, 80);
pair<string, double> mixin_times_scale = xmreg::timestamps_time_scale(
mixin_timestamps,
server_timestamp, 100);
// add beginning and end to the mixin_times_scale
string timescale_str = string("Genesis<")
+ mixin_times_scale
+ mixin_times_scale.first
+ string(">") + server_time_str;
timescale_scale = mixin_times_scale.second ;
// save the string timescales for later to show
mixins_timescales.push_back(mstch::map {{"timescale", timescale_str}});
}
context["inputs"] = inputs;
context["timescales"] = mixins_timescales;
context["inputs"] = inputs;
context["timescales"] = mixins_timescales;
context["timescales_scale"] = fmt::format("{:0.2f}",
timescale_scale / 3600.0 / 24.0); // in days
mstch::array outputs;

@ -73,28 +73,30 @@
<h3>Mixins time scale</h3>
<ul class="center">
{{#timescales}}
<li class="center" style="list-style-type: none;">{{timescale}}</li>
{{/timescales}}
</ul>
<h3>Outputs</h3>
<div class="center">
<table class="center" >
<tr>
<td>out_pub_key</td>
<td>amount</td>
</tr>
{{#outputs}}
<tr>
<td>{{out_pub_key}}</td>
<td>{{amount}}</td>
</tr>
{{/outputs}}
</table>
<h3>Mixins time scale (resolution: {{timescales_scale}} days)</h3>
<div class="center">
<ul class="center">
{{#timescales}}
<li class="center" style="list-style-type: none;">{{timescale}}</li>
{{/timescales}}
</ul>
</div>
<h3>Outputs</h3>
<div class="center">
<table class="center" >
<tr>
<td>out_pub_key</td>
<td>amount</td>
</tr>
{{#outputs}}
<tr>
<td>{{out_pub_key}}</td>
<td>{{amount}}</td>
</tr>
{{/outputs}}
</table>
</div>
</div>

@ -527,7 +527,7 @@ namespace xmreg
std::istreambuf_iterator<char>());
}
string
pair<string, double>
timestamps_time_scale(const vector<uint64_t>& timestamps,
uint64_t timeN, uint64_t resolution, uint64_t time0)
{
@ -553,7 +553,7 @@ namespace xmreg
empty_time[timestamp_place + 1] = '*';
}
return empty_time;
return make_pair(empty_time, scale);
}

@ -199,7 +199,7 @@ namespace xmreg
std::cout << "]" << std::endl;
}
string
pair<string, double>
timestamps_time_scale(const vector<uint64_t>& timestamps,
uint64_t timeN, uint64_t resolution = 80,
uint64_t time0 = 1397818193 /* timestamp of the second block */);

Loading…
Cancel
Save