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


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

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


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

示例1: assert

bool
NMEALogger::Start()
{
  if (writer != nullptr)
    return true;

  BrokenDateTime dt = BrokenDateTime::NowUTC();
  assert(dt.IsPlausible());

  StaticString<64> name;
  name.Format(_T("%04u-%02u-%02u_%02u-%02u.nmea"),
              dt.year, dt.month, dt.day,
              dt.hour, dt.minute);

  const auto logs_path = MakeLocalPath(_T("logs"));

  const auto path = AllocatedPath::Build(logs_path, name);
  writer = new TextWriter(path, false);
  if (writer == nullptr)
    return false;

  if (!writer->IsOpen()) {
    delete writer;
    writer = nullptr;
    return false;
  }

  return true;
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:29,代码来源:NMEALogger.cpp

示例2:

static void
WriteEvent(JSON::ObjectWriter &object, const char *name,
           const BrokenDateTime &time, const GeoPoint &location)
{
  if (time.IsPlausible() || location.IsValid())
    object.WriteElement(name, WriteEventAttributes, time, location);
}
开发者ID:MindMil,项目名称:XCSoar,代码行数:7,代码来源:AnalyseFlight.cpp

示例3: object

static void
WriteEventAttributes(TextWriter &writer,
                     const BrokenDateTime &time, const GeoPoint &location)
{
  JSON::ObjectWriter object(writer);

  if (time.IsPlausible()) {
    NarrowString<64> buffer;
    FormatISO8601(buffer.buffer(), time);
    object.WriteElement("time", JSON::WriteString, buffer);
  }

  if (location.IsValid())
    JSON::WriteGeoPointAttributes(object, location);
}
开发者ID:MindMil,项目名称:XCSoar,代码行数:15,代码来源:AnalyseFlight.cpp

示例4: assert

void
FormatIGCTaskTimestamp(char *buffer, const BrokenDateTime &date_time,
                       unsigned number_of_turnpoints)
{
  assert(date_time.IsPlausible());

  sprintf(buffer, "C%02u%02u%02u%02u%02u%02u0000000000%02u",
          // DD  MM  YY  HH  MM  SS  DD  MM  YY IIII TT
          date_time.day,
          date_time.month,
          date_time.year % 100,
          date_time.hour,
          date_time.minute,
          date_time.second,
          number_of_turnpoints - 2);
}
开发者ID:MaxPower-No1,项目名称:XCSoar,代码行数:16,代码来源:Generator.cpp

示例5: assert

bool
NMEALogger::Start()
{
  if (writer != nullptr)
    return true;

  BrokenDateTime dt = BrokenDateTime::NowUTC();
  assert(dt.IsPlausible());

  StaticString<64> name;
  name.Format(_T("%04u-%02u-%02u_%02u-%02u.nmea"),
              dt.year, dt.month, dt.day,
              dt.hour, dt.minute);

  TCHAR path[MAX_PATH];
  LocalPath(path, _T("logs"));
  Directory::Create(path);

  LocalPath(path, _T("logs"), name);

  writer = new TextWriter(path, false);
  return writer != nullptr;
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:23,代码来源:NMEALogger.cpp

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