当前位置: 首页>>代码示例>>C++>>正文


C++ BrokenDateTime::ToUnixTimeUTC方法代码示例

本文整理汇总了C++中BrokenDateTime::ToUnixTimeUTC方法的典型用法代码示例。如果您正苦于以下问题:C++ BrokenDateTime::ToUnixTimeUTC方法的具体用法?C++ BrokenDateTime::ToUnixTimeUTC怎么用?C++ BrokenDateTime::ToUnixTimeUTC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BrokenDateTime的用法示例。


在下文中一共展示了BrokenDateTime::ToUnixTimeUTC方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Reduce

void Flight::Reduce(const BrokenDateTime start, const BrokenDateTime end,
                    const unsigned num_levels, const unsigned zoom_factor,
                    const double threshold, const bool force_endpoints,
                    const unsigned max_delta_time, const unsigned max_points) {
  // we need the whole flight, so read it now...
  if (!keep_flight) {
    ReadFlight();
    keep_flight = true;
  }

  DouglasPeuckerMod dp(num_levels, zoom_factor, threshold,
    force_endpoints, max_delta_time, max_points);

  unsigned start_index = 0,
           end_index = 0;

  int64_t start_time = start.ToUnixTimeUTC(),
          end_time = end.ToUnixTimeUTC();

  for (auto fix : *fixes) {
    if (BrokenDateTime(fix.date, fix.time).ToUnixTimeUTC() < start_time)
      start_index++;

    if (BrokenDateTime(fix.date, fix.time).ToUnixTimeUTC() < end_time)
      end_index++;
    else
      break;
  }

  end_index = std::min(end_index, unsigned(fixes->size()));
  start_index = std::min(start_index, end_index);

  dp.Encode(*fixes, start_index, end_index);
}
开发者ID:CnZoom,项目名称:XcSoarWork,代码行数:34,代码来源:Flight.cpp

示例2: ToUnixTimeUTC

int
BrokenDateTime::operator-(const BrokenDateTime &other) const
{
  return ToUnixTimeUTC() - other.ToUnixTimeUTC();
}
开发者ID:FlorianR,项目名称:XCSoar,代码行数:5,代码来源:DateTime.cpp

示例3: glide_polar

void
Run(DebugReplay &replay, FlightPhaseDetector &flight_phase_detector,
    WindList &wind_list,
    const BrokenDateTime &takeoff_time,
    const BrokenDateTime &scoring_start_time,
    const BrokenDateTime &scoring_end_time,
    const BrokenDateTime &landing_time,
    Trace &full_trace, Trace &triangle_trace, Trace &sprint_trace,
    ComputerSettings &computer_settings)
{
    GeoPoint last_location = GeoPoint::Invalid();
    constexpr Angle max_longitude_change = Angle::Degrees(30);
    constexpr Angle max_latitude_change = Angle::Degrees(1);

    CirclingSettings circling_settings;
    circling_settings.SetDefaults();
    CirclingComputer circling_computer;
    circling_computer.Reset();

    GlidePolar glide_polar(0);

    WindSettings wind_settings;
    wind_settings.SetDefaults();

    WindComputer wind_computer;
    wind_computer.Reset();

    Validity last_wind;
    last_wind.Clear();

    const Waypoints waypoints;
    AutoQNH auto_qnh(5);
    auto_qnh.Reset();

    const int64_t takeoff_unix = takeoff_time.ToUnixTimeUTC();
    const int64_t landing_unix = landing_time.ToUnixTimeUTC();


    int64_t scoring_start_unix, scoring_end_unix;

    if (scoring_start_time.IsPlausible())
        scoring_start_unix = scoring_start_time.ToUnixTimeUTC();
    else
        scoring_start_unix = std::numeric_limits<int64_t>::max();

    if (scoring_end_time.IsPlausible())
        scoring_end_unix = scoring_end_time.ToUnixTimeUTC();
    else
        scoring_end_unix = 0;


    while (replay.Next()) {
        const MoreData &basic = replay.Basic();
        const int64_t date_time_utc = basic.date_time_utc.ToUnixTimeUTC();

        if (date_time_utc < takeoff_unix)
            continue;

        if (date_time_utc > landing_unix)
            break;

        circling_computer.TurnRate(replay.SetCalculated(),
                                   replay.Basic(),
                                   replay.Calculated().flight);
        circling_computer.Turning(replay.SetCalculated(),
                                  replay.Basic(),
                                  replay.Calculated().flight,
                                  circling_settings);

        flight_phase_detector.Update(replay.Basic(), replay.Calculated());

        wind_computer.Compute(wind_settings, glide_polar, basic,
                              replay.SetCalculated());

        if (replay.Calculated().estimated_wind_available.Modified(last_wind)) {
            wind_list.push_back(WindListItem(basic.date_time_utc, basic.gps_altitude,
                                             replay.Calculated().estimated_wind));
        }

        last_wind = replay.Calculated().estimated_wind_available;

        auto_qnh.Process(basic, replay.SetCalculated(), computer_settings, waypoints);

        if (!computer_settings.pressure_available && replay.Calculated().pressure_available) {
            computer_settings.pressure = replay.Calculated().pressure;
            computer_settings.pressure_available = replay.Calculated().pressure_available;
        }

        if (!basic.time_available || !basic.location_available ||
                !basic.NavAltitudeAvailable())
            continue;

        if (last_location.IsValid() &&
                ((last_location.latitude - basic.location.latitude).Absolute() > max_latitude_change ||
                 (last_location.longitude - basic.location.longitude).Absolute() > max_longitude_change))
            /* there was an implausible warp, which is usually triggered by
               an invalid point declared "valid" by a bugged logger; if that
               happens, we stop the analysis, because the IGC file is
               obviously broken */
            break;
//.........这里部分代码省略.........
开发者ID:ahsparrow,项目名称:xcsoar,代码行数:101,代码来源:AnalyseFlight.cpp


注:本文中的BrokenDateTime::ToUnixTimeUTC方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。