This commit is contained in:
EntireTwix 2021-05-28 16:20:27 -07:00
commit 56aa6f31f0
2 changed files with 7 additions and 4 deletions

View file

@ -2,15 +2,18 @@
#include <chrono>
#include <cstdint>
//42 bytes total
struct Transaction
{
std::string from = "", to = "";
uint32_t amount = 0;
uint64_t time = 0;
Transaction() = default;
Transaction(std::string from_str, std::string to_str, uint32_t amount, uint64_t time) : amount(amount), time(time)
{
from = std::move(from_str);
to = std::move(to_str);
}
Transaction(std::string from_str, std::string to_str, uint32_t amount) : amount(amount)
{
using namespace std::chrono;
@ -18,4 +21,4 @@ struct Transaction
to = std::move(to_str);
time = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
}
};
};

View file

@ -47,7 +47,7 @@ struct User
}
for (uint32_t i = 0; i < log.end; ++i)
{
log.data[i] = std::move(Transaction(log_j[i]["from"].asCString(), log_j[i]["to"].asCString(), log_j[i]["amount"].asUInt()));
log.data[i] = std::move(Transaction(log_j[i]["from"].asCString(), log_j[i]["to"].asCString(), log_j[i]["amount"].asUInt(), log_j[i]["time"].asUInt64()));
}
}
}