🐛 changed uint64 to time_t

This commit is contained in:
EntireTwix 2021-06-23 14:24:20 -07:00
parent 22d8001066
commit 6637f0042e
3 changed files with 7 additions and 4 deletions

View file

@ -7,9 +7,9 @@ struct Transaction
{ {
std::string from = "", to = ""; std::string from = "", to = "";
uint32_t amount = 0; uint32_t amount = 0;
uint64_t time = 0; time_t time = 0;
Transaction(); Transaction();
Transaction(std::string from_str, std::string to_str, uint32_t amount, uint64_t time); Transaction(std::string from_str, std::string to_str, uint32_t amount, time_t time);
Transaction(std::string from_str, std::string to_str, uint32_t amount); Transaction(std::string from_str, std::string to_str, uint32_t amount);
}; };

View file

@ -1,14 +1,13 @@
#include "transaction.h" #include "transaction.h"
Transaction::Transaction() = default; Transaction::Transaction() = default;
Transaction::Transaction(std::string from_str, std::string to_str, uint32_t amount, uint64_t time) : amount(amount), time(time) Transaction::Transaction(std::string from_str, std::string to_str, uint32_t amount, time_t time) : amount(amount), time(time)
{ {
from = std::move(from_str); from = std::move(from_str);
to = std::move(to_str); to = std::move(to_str);
} }
Transaction::Transaction(std::string from_str, std::string to_str, uint32_t amount) : amount(amount) Transaction::Transaction(std::string from_str, std::string to_str, uint32_t amount) : amount(amount)
{ {
using namespace std::chrono;
from = std::move(from_str); from = std::move(from_str);
to = std::move(to_str); to = std::move(to_str);
time = std::time(NULL); time = std::time(NULL);

View file

@ -33,7 +33,11 @@ User::User(uint32_t init_bal, uint64_t init_pass, const Json::Value &log_j) : ba
log_j[i]["from"].asCString(), log_j[i]["from"].asCString(),
log_j[i]["to"].asCString(), log_j[i]["to"].asCString(),
log_j[i]["amount"].asUInt(), log_j[i]["amount"].asUInt(),
#ifdef _USE_32BIT_TIME_T
log_j[i]["time"].asUInt()));
#else
log_j[i]["time"].asUInt64())); log_j[i]["time"].asUInt64()));
#endif
} }
} }
} }