mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 00:22:14 +11:00
Merge branch 'main' of https://github.com/EntireTwix/CCash
This commit is contained in:
commit
56aa6f31f0
2 changed files with 7 additions and 4 deletions
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue