1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #ifndef TEST_DRIFTING_CLOCK_H_
- #define TEST_DRIFTING_CLOCK_H_
- #include <stdint.h>
- #include "system_wrappers/include/clock.h"
- #include "system_wrappers/include/ntp_time.h"
- namespace webrtc {
- namespace test {
- class DriftingClock : public Clock {
- public:
- static constexpr float kNoDrift = 1.0f;
- DriftingClock(Clock* clock, float speed);
- static constexpr float PercentsFaster(float percent) {
- return 1.0f + percent / 100.0f;
- }
- static constexpr float PercentsSlower(float percent) {
- return 1.0f - percent / 100.0f;
- }
- Timestamp CurrentTime() override;
- NtpTime CurrentNtpTime() override;
- int64_t CurrentNtpInMilliseconds() override;
- private:
- TimeDelta Drift() const;
- Clock* const clock_;
- const float drift_;
- const Timestamp start_time_;
- };
- }
- }
- #endif
|