| 28 | } |
| 29 | |
| 30 | inline double NextTime(double targetTime) { |
| 31 | if (frequency_ <= 0) { |
| 32 | return targetTime; |
| 33 | } |
| 34 | auto timeDiff = targetTime - startTime_; |
| 35 | auto div = std::div((long) timeDiff, (long) frequency_); |
| 36 | return startTime_ + frequency_ * (div.quot + 1); |
| 37 | } |
| 38 | |
| 39 | inline void Unschedule() { |
| 40 | callback_.Reset(); |