diff options
| author | levlam <levlam@telegram.org> | 2018-02-20 03:03:28 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2018-02-20 03:03:28 +0300 |
| commit | 4304fcfd89d66368d686ed19efb5b324cbb77df2 (patch) | |
| tree | 44f3f45d2dac764f671979bf831831a73b119a77 /tdutils/td/utils/TimedStat.h | |
| parent | b676810b50fa8c1b5bd0090e8e5663b48d03deb6 (diff) | |
Better double comparison.
GitOrigin-RevId: 5a7092ce72e7531835d57455a8027819a6f03ab5
Diffstat (limited to 'tdutils/td/utils/TimedStat.h')
| -rw-r--r-- | tdutils/td/utils/TimedStat.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tdutils/td/utils/TimedStat.h b/tdutils/td/utils/TimedStat.h index 3ab7e0c49..fc4197470 100644 --- a/tdutils/td/utils/TimedStat.h +++ b/tdutils/td/utils/TimedStat.h @@ -46,8 +46,11 @@ class TimedStat { StatT next_; double next_timestamp_; - void update(double now) { - CHECK(now >= next_timestamp_); + void update(double &now) { + if (now < next_timestamp_) { + CHECK(now >= next_timestamp_ * (1 - 1e-14)) << now << " " << next_timestamp_; + now = next_timestamp_; + } if (duration_ == 0) { return; } |
