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

@ -73,12 +73,14 @@
<h3>Mixins time scale</h3> <h3>Mixins time scale (resolution: {{timescales_scale}} days)</h3>
<div class="center">
<ul class="center"> <ul class="center">
{{#timescales}} {{#timescales}}
<li class="center" style="list-style-type: none;">{{timescale}}</li> <li class="center" style="list-style-type: none;">{{timescale}}</li>
{{/timescales}} {{/timescales}}
</ul> </ul>
</div>
<h3>Outputs</h3> <h3>Outputs</h3>

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

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

Loading…
Cancel
Save