mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
added xmreg::ptime_to_time_t() to tools.h
This commit is contained in:
parent
25e548af2e
commit
acd6d2afd7
3 changed files with 14 additions and 3 deletions
|
@ -2248,21 +2248,22 @@ namespace xmreg {
|
|||
// such search start with "aoi_", e.g., "aoi_444-23.00"
|
||||
bool search_for_amount_output_idx = (search_text.substr(0, 4) == "aoi_");
|
||||
|
||||
|
||||
// check if date given in format: 2005-04-55
|
||||
// this is 10 characters
|
||||
if (search_text.length() == 10)
|
||||
if (search_text.length() == 19)
|
||||
{
|
||||
uint64_t estimated_blk_height {0};
|
||||
|
||||
// first parse the string date into boost's ptime object
|
||||
dateparser parser {"%Y-%m-%d"};
|
||||
dateparser parser {"%Y-%m-%d %H:%M:%S"};
|
||||
|
||||
if (parser(search_text))
|
||||
{
|
||||
// seems we have a correct date!
|
||||
// so try to estimate block height from it.
|
||||
|
||||
cout << "timestamp: " << xmreg::ptime_to_time_t(parser.pt) << endl;
|
||||
|
||||
// estimate blockchain height from the start date provided
|
||||
estimated_blk_height = xmreg::estimate_bc_height(search_text);
|
||||
|
||||
|
|
|
@ -629,6 +629,13 @@ namespace xmreg
|
|||
return make_pair(empty_time, scale);
|
||||
}
|
||||
|
||||
time_t
|
||||
ptime_to_time_t(const pt::ptime& in_ptime)
|
||||
{
|
||||
static pt::ptime epoch(gt::date(1970, 1, 1));
|
||||
pt::time_duration::sec_type no_seconds = (in_ptime - epoch).total_seconds();
|
||||
return time_t(no_seconds);
|
||||
}
|
||||
|
||||
bool
|
||||
decode_ringct(const rct::rctSig& rv,
|
||||
|
|
|
@ -220,6 +220,9 @@ namespace xmreg
|
|||
uint64_t time0 = 1397818193 /* timestamp of the second block */);
|
||||
|
||||
|
||||
time_t
|
||||
ptime_to_time_t(const pt::ptime& in_ptime);
|
||||
|
||||
bool
|
||||
decode_ringct(const rct::rctSig & rv,
|
||||
const crypto::public_key pub,
|
||||
|
|
Loading…
Reference in a new issue