tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SystemTime.h (1694B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef DOM_MEDIA_WEBRTC_LIBWEBRTCGLUE_SYSTEMTIMENANOS_H_
      8 #define DOM_MEDIA_WEBRTC_LIBWEBRTCGLUE_SYSTEMTIMENANOS_H_
      9 
     10 #include "jsapi/RTCStatsReport.h"
     11 #include "mozilla/TimeStamp.h"
     12 #include "system_wrappers/include/clock.h"
     13 
     14 namespace mozilla {
     15 class RTCStatsTimestampMakerRealtimeClock : public webrtc::Clock {
     16 public:
     17  explicit RTCStatsTimestampMakerRealtimeClock(
     18      const dom::RTCStatsTimestampMaker& aTimestampMaker);
     19 
     20  webrtc::Timestamp CurrentTime() override;
     21 
     22  // Upstream, this method depend on rtc::TimeUTCMicros for converting the
     23  // monotonic system clock to Ntp, if only for the first call when deciding the
     24  // Ntp offset.
     25  // We override this to be able to use our own clock instead of
     26  // rtc::TimeUTCMicros for ntp timestamps.
     27  webrtc::NtpTime ConvertTimestampToNtpTime(
     28      webrtc::Timestamp aRealtime) override;
     29 
     30  const dom::RTCStatsTimestampMaker mTimestampMaker;
     31 };
     32 
     33 // The time base used for WebrtcSystemTime(). Completely arbitrary. Constant.
     34 TimeStamp WebrtcSystemTimeBase();
     35 
     36 // The returned timestamp denotes the monotonic time passed since
     37 // WebrtcSystemTimeBase(). Libwebrtc uses this to track how time advances from a
     38 // specific point in time. It adds an offset to make the timestamps absolute.
     39 webrtc::Timestamp WebrtcSystemTime();
     40 
     41 webrtc::NtpTime CreateNtp(webrtc::Timestamp aTime);
     42 }  // namespace mozilla
     43 
     44 #endif