diff --git a/src/page.h b/src/page.h index 5ca87dd..ea8491f 100644 --- a/src/page.h +++ b/src/page.h @@ -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 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; diff --git a/src/templates/tx.html b/src/templates/tx.html index 41e866e..580e65f 100644 --- a/src/templates/tx.html +++ b/src/templates/tx.html @@ -41,7 +41,7 @@ amount - {{#inputs}} + {{#inputs}} {{in_key_img}} {{amount}} @@ -73,28 +73,30 @@ -

Mixins time scale

- - - -

Outputs

-
- - - - - - {{#outputs}} - - - - - {{/outputs}} -
out_pub_keyamount
{{out_pub_key}}{{amount}}
+

Mixins time scale (resolution: {{timescales_scale}} days)

+
+
    + {{#timescales}} +
  • {{timescale}}
  • + {{/timescales}} +
+
+ + +

Outputs

+
+ + + + + + {{#outputs}} + + + + + {{/outputs}} +
out_pub_keyamount
{{out_pub_key}}{{amount}}
diff --git a/src/tools.cpp b/src/tools.cpp index 6102f7a..d7ac88c 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -527,7 +527,7 @@ namespace xmreg std::istreambuf_iterator()); } - string + pair timestamps_time_scale(const vector& 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); } diff --git a/src/tools.h b/src/tools.h index fb29269..397bd63 100644 --- a/src/tools.h +++ b/src/tools.h @@ -199,7 +199,7 @@ namespace xmreg std::cout << "]" << std::endl; } - string + pair timestamps_time_scale(const vector& timestamps, uint64_t timeN, uint64_t resolution = 80, uint64_t time0 = 1397818193 /* timestamp of the second block */);