mirror of
https://github.com/Expand-sys/CCash
synced 2026-03-22 12:37:08 +11:00
✨ time added as part of log
This commit is contained in:
parent
fcff1c5074
commit
d96364d1f0
2 changed files with 11 additions and 3 deletions
|
|
@ -207,15 +207,18 @@ public:
|
|||
|
||||
Json::Value res;
|
||||
if (!(logs.if_contains(name, [&res](const Log &l) {
|
||||
uint32_t j;
|
||||
for (uint32_t i = l.data.size() - 1; i > 0; --i)
|
||||
{
|
||||
j = 99 - i;
|
||||
if (!l.data[i].amount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
res[99 - i]["to"] = l.data[i].to;
|
||||
res[99 - i]["from"] = l.data[i].from;
|
||||
res[99 - i]["amount"] = l.data[i].amount;
|
||||
res[j]["to"] = l.data[i].to;
|
||||
res[j]["from"] = l.data[i].from;
|
||||
res[j]["amount"] = l.data[i].amount;
|
||||
res[j]["time"] = l.data[i].time;
|
||||
}
|
||||
})))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
#pragma once
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
|
||||
//24 bytes total
|
||||
struct Transaction
|
||||
{
|
||||
|
||||
std::string from = "", to = "";
|
||||
uint32_t amount = 0;
|
||||
uint32_t time = 0;
|
||||
|
||||
void Concatinate(std::string &s)
|
||||
{
|
||||
|
|
@ -21,9 +24,11 @@ struct Transaction
|
|||
Transaction() = default;
|
||||
Transaction(std::string from_str, std::string to_str, uint32_t amount) : amount(amount)
|
||||
{
|
||||
using namespace std::chrono;
|
||||
Concatinate(from_str);
|
||||
Concatinate(to_str);
|
||||
from = std::move(from_str);
|
||||
to = std::move(to_str);
|
||||
time = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
|
||||
}
|
||||
};
|
||||
Loading…
Reference in a new issue