mirror of
https://github.com/ton-blockchain/ton
synced 2025-02-12 11:12:16 +00:00
Fix compilation errors in windows (#417)
This commit is contained in:
parent
f6bf3d696d
commit
90e06e3394
2 changed files with 17 additions and 20 deletions
|
@ -240,7 +240,8 @@ void OverlayImpl::alarm() {
|
|||
|
||||
if(update_throughput_at_.is_in_past()) {
|
||||
double t_elapsed = td::Time::now() - last_throughput_update_.at();
|
||||
|
||||
|
||||
auto SelfId = actor_id(this);
|
||||
peers_.iterate([&](const adnl::AdnlNodeIdShort &key, OverlayPeer &peer) {
|
||||
peer.throughput_out_bytes = static_cast<td::uint32>(peer.throughput_out_bytes_ctr / t_elapsed);
|
||||
peer.throughput_in_bytes = static_cast<td::uint32>(peer.throughput_in_bytes_ctr / t_elapsed);
|
||||
|
@ -254,7 +255,7 @@ void OverlayImpl::alarm() {
|
|||
peer.throughput_out_packets_ctr = 0;
|
||||
peer.throughput_in_packets_ctr = 0;
|
||||
|
||||
auto P = td::PromiseCreator::lambda([SelfId = actor_id(this), peer_id = key](td::Result<td::string> result) {
|
||||
auto P = td::PromiseCreator::lambda([SelfId, peer_id = key](td::Result<td::string> result) {
|
||||
result.ensure();
|
||||
td::actor::send_closure(SelfId, &Overlay::update_peer_ip_str, peer_id, result.move_as_ok());
|
||||
});
|
||||
|
|
|
@ -193,6 +193,20 @@ class Query : public td::actor::Actor {
|
|||
virtual std::string name() const = 0;
|
||||
void handle_error(td::Status error);
|
||||
|
||||
static std::string time_to_human(int unixtime) {
|
||||
char time_buffer[80];
|
||||
time_t rawtime = unixtime;
|
||||
struct tm tInfo;
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
struct tm* timeinfo = localtime_s(&tInfo, &rawtime) ? nullptr : &tInfo;
|
||||
#else
|
||||
struct tm* timeinfo = localtime_r(&rawtime, &tInfo);
|
||||
#endif
|
||||
assert(timeinfo == &tInfo);
|
||||
strftime(time_buffer, 80, "%c", timeinfo);
|
||||
return std::string(time_buffer);
|
||||
}
|
||||
|
||||
protected:
|
||||
td::actor::ActorId<ValidatorEngineConsole> console_;
|
||||
Tokenizer tokenizer_;
|
||||
|
@ -918,15 +932,6 @@ class GetOverlaysStatsQuery : public Query {
|
|||
static std::string get_help() {
|
||||
return "getoverlaysstats\tgets stats for all overlays";
|
||||
}
|
||||
static std::string time_to_human(int unixtime) {
|
||||
char time_buffer[80];
|
||||
time_t rawtime = unixtime;
|
||||
struct tm tInfo;
|
||||
struct tm* timeinfo = localtime_r(&rawtime, &tInfo);
|
||||
assert(timeinfo == &tInfo);
|
||||
strftime(time_buffer, 80, "%c", timeinfo);
|
||||
return std::string(time_buffer);
|
||||
}
|
||||
std::string name() const override {
|
||||
return get_name();
|
||||
}
|
||||
|
@ -946,15 +951,6 @@ class GetOverlaysStatsJsonQuery : public Query {
|
|||
static std::string get_help() {
|
||||
return "getoverlaysstatsjson <outfile>\tgets stats for all overlays and writes to json file";
|
||||
}
|
||||
static std::string time_to_human(int unixtime) {
|
||||
char time_buffer[80];
|
||||
time_t rawtime = unixtime;
|
||||
struct tm tInfo;
|
||||
struct tm* timeinfo = localtime_r(&rawtime, &tInfo);
|
||||
assert(timeinfo == &tInfo);
|
||||
strftime(time_buffer, 80, "%c", timeinfo);
|
||||
return std::string(time_buffer);
|
||||
}
|
||||
std::string name() const override {
|
||||
return get_name();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue