1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

updated tonlib, new fullnode queries

This commit is contained in:
ton 2019-09-24 01:10:57 +04:00
parent 87ccb27b70
commit a1e352d894
40 changed files with 1188 additions and 175 deletions

View file

@ -25,15 +25,40 @@
namespace td {
Timer::Timer() : start_time_(Time::now()) {
Timer::Timer(bool is_paused) : is_paused_(is_paused) {
if (is_paused_) {
start_time_ = 0;
} else {
start_time_ = Time::now();
}
}
void Timer::pause() {
if (is_paused_) {
return;
}
elapsed_ += Time::now() - start_time_;
is_paused_ = true;
}
void Timer::resume() {
if (!is_paused_) {
return;
}
start_time_ = Time::now();
is_paused_ = false;
}
double Timer::elapsed() const {
return Time::now() - start_time_;
double res = elapsed_;
if (!is_paused_) {
res += Time::now() - start_time_;
}
return res;
}
StringBuilder &operator<<(StringBuilder &string_builder, const Timer &timer) {
return string_builder << "in " << Time::now() - timer.start_time_;
return string_builder << format::as_time(timer.elapsed());
}
PerfWarningTimer::PerfWarningTimer(string name, double max_duration)