| 1 | // Copyright 2013 The Flutter Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef FLUTTER_FML_TIME_TIMESTAMP_PROVIDER_H_ |
| 6 | #define FLUTTER_FML_TIME_TIMESTAMP_PROVIDER_H_ |
| 7 | |
| 8 | #include <cstdint> |
| 9 | |
| 10 | #include "flutter/fml/time/time_point.h" |
| 11 | |
| 12 | namespace fml { |
| 13 | |
| 14 | /// Pluggable provider of monotonic timestamps. Invocations of `Now` must return |
| 15 | /// unique values. Any two consecutive invocations must be ordered. |
| 16 | class TimestampProvider { |
| 17 | public: |
| 18 | virtual ~TimestampProvider(){}; |
| 19 | |
| 20 | // Returns the number of ticks elapsed by a monotonic clock since epoch. |
| 21 | virtual fml::TimePoint Now() = 0; |
| 22 | }; |
| 23 | |
| 24 | } // namespace fml |
| 25 | |
| 26 | #endif // FLUTTER_FML_TIME_TIMESTAMP_PROVIDER_H_ |
| 27 | |