コード例 #1
0
ファイル: GPSClock.hpp プロジェクト: MindMil/XCSoar
  /**
   * Checks whether the specified duration (dt) has passed since the last
   * update. If yes, it updates the time stamp.
   * @param now Current time
   * @param dt The timestep in seconds
   * @return
   */
  bool CheckAdvance(const fixed now, const fixed dt) {
    if (CheckReverse(now))
      return false;

    if (now >= last + dt) {
      Update(now);
      return true;
    } else
      return false;
  }
コード例 #2
0
ファイル: GPSClock.hpp プロジェクト: XCSoar/XCSoar
  /**
   * Checks whether the specified duration (dt) has passed since the last
   * update. If yes, it updates the time stamp.
   * @param now Current time
   * @param dt The timestep in seconds
   * @return
   */
  bool CheckAdvance(const double now,
                    const std::chrono::steady_clock::duration dt) noexcept {
    if (CheckReverse(now))
      return false;

    if (now >= last + std::chrono::duration_cast<std::chrono::duration<double>>(dt).count()) {
      Update(now);
      return true;
    } else
      return false;
  }
コード例 #3
0
ファイル: GPSClock.hpp プロジェクト: damianob/xcsoar
  fixed DeltaAdvance(const fixed now) {
    if (CheckReverse(now))
      return fixed_minus_one;

    // check if time has advanced past dt
    if (now - last >= dt) {
      fixed dt = now - last;
      Update(now);
      return dt;
    } else {
      return fixed_zero;
    }
  }