/* * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
// Implements a time counter. The counter is advanced with the Increment() // methods, and is queried with the ticks() accessor. It is assumed that one // "tick" of the counter corresponds to 10 ms. // A TickTimer object can provide two types of associated time-measuring // objects: Stopwatch and Countdown. class TickTimer { public: // Stopwatch measures time elapsed since it was started, by querying the // associated TickTimer for the current time. The intended use is to request a // new Stopwatch object from a TickTimer object with the GetNewStopwatch() // method. Note: since the Stopwatch object contains a reference to the // TickTimer it is associated with, it cannot outlive the TickTimer. class Stopwatch { public: explicit Stopwatch(const TickTimer& ticktimer);
// Countdown counts down from a given start value with each tick of the // associated TickTimer, until zero is reached. The Finished() method will // return true if zero has been reached, false otherwise. The intended use is // to request a new Countdown object from a TickTimer object with the // GetNewCountdown() method. Note: since the Countdown object contains a // reference to the TickTimer it is associated with, it cannot outlive the // TickTimer. class Countdown { public:
Countdown(const TickTimer& ticktimer, uint64_t ticks_to_count);
// Returns a new Stopwatch object, based on the current TickTimer. Note that // the new Stopwatch object contains a reference to the current TickTimer, // and must therefore not outlive the TickTimer.
std::unique_ptr<Stopwatch> GetNewStopwatch() const { return std::unique_ptr<Stopwatch>(new Stopwatch(*this));
}
// Returns a new Countdown object, based on the current TickTimer. Note that // the new Countdown object contains a reference to the current TickTimer, // and must therefore not outlive the TickTimer.
std::unique_ptr<Countdown> GetNewCountdown(uint64_t ticks_to_count) const { return std::unique_ptr<Countdown>(new Countdown(*this, ticks_to_count));
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.21Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.