本文整理汇总了C++中BrokenDateTime::Plausible方法的典型用法代码示例。如果您正苦于以下问题:C++ BrokenDateTime::Plausible方法的具体用法?C++ BrokenDateTime::Plausible怎么用?C++ BrokenDateTime::Plausible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BrokenDateTime
的用法示例。
在下文中一共展示了BrokenDateTime::Plausible方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static void
WriteEvent(JSON::ObjectWriter &object, const char *name,
const BrokenDateTime &time, const GeoPoint &location)
{
if (time.Plausible() || location.IsValid())
object.WriteElement(name, WriteEventAttributes, time, location);
}
示例2: fixed
fixed
SunEphemeris::FNday(const BrokenDateTime &date_time)
{
assert(date_time.Plausible());
long int luku = -7 * (date_time.year + (date_time.month + 9) / 12) / 4 +
275 * date_time.month / 9 + date_time.day +
(long int)date_time.year * 367;
return fixed(luku) - fixed(730531.5) + fixed(date_time.hour % 24) / 24;
}
示例3: assert
void
IGCWriter::WriteHeader(const BrokenDateTime &date_time,
const TCHAR *pilot_name, const TCHAR *aircraft_model,
const TCHAR *aircraft_registration,
const TCHAR *competition_id,
const char *logger_id, const TCHAR *driver_name,
bool simulator)
{
/*
* HFDTE141203 <- should be UTC, same as time in filename
* HFFXA100
* HFPLTPILOT:JOHN WHARINGTON
* HFGTYGLIDERTYPE:LS 3
* HFGIDGLIDERID:VH-WUE
* HFDTM100GPSDATUM:WGS84
* HFRFWFIRMWAREVERSION:3.6
* HFRHWHARDWAREVERSION:3.4
* HFFTYFR TYPE:GARRECHT INGENIEURGESELLSCHAFT,VOLKSLOGGER 1.0
* HFCIDCOMPETITIONID:WUE
* HFCCLCOMPETITIONCLASS:FAI
*/
assert(date_time.Plausible());
assert(logger_id != NULL);
assert(strlen(logger_id) == 3);
char buffer[100];
// Flight recorder ID number MUST go first..
sprintf(buffer, "AXCS%s", logger_id);
WriteLine(buffer);
sprintf(buffer, "HFDTE%02u%02u%02u",
date_time.day, date_time.month, date_time.year % 100);
WriteLine(buffer);
if (!simulator)
WriteLine(GetHFFXARecord());
WriteLine("HFPLTPILOT:", pilot_name);
WriteLine("HFGTYGLIDERTYPE:", aircraft_model);
WriteLine("HFGIDGLIDERID:", aircraft_registration);
WriteLine("HFCIDCOMPETITIONID:", competition_id);
WriteLine("HFFTYFRTYPE:XCSOAR,XCSOAR ", XCSoar_VersionStringOld);
WriteLine("HFGPS:", driver_name);
WriteLine("HFDTM100DATUM:WGS-84");
WriteLine(GetIRecord());
}
示例4: object
static void
WriteEventAttributes(TextWriter &writer,
const BrokenDateTime &time, const GeoPoint &location)
{
JSON::ObjectWriter object(writer);
if (time.Plausible()) {
NarrowString<64> buffer;
FormatISO8601(buffer.buffer(), time);
object.WriteElement("time", JSON::WriteString, buffer);
}
if (location.IsValid())
JSON::WriteGeoPointAttributes(object, location);
}
示例5: assert
static bool
RawLoggerStart()
{
if (RawLoggerWriter != NULL)
return true;
BrokenDateTime dt = XCSoarInterface::Basic().DateTime;
assert(dt.Plausible());
TCHAR path[MAX_PATH];
LocalPath(path, _T("logs"));
unsigned len = _tcslen(path);
_sntprintf(path+len, MAX_PATH-len,
_T(DIR_SEPARATOR_S "%04u-%02u-%02u_%02u-%02u.nmea"),
dt.year, dt.month, dt.day,
dt.hour, dt.minute);
RawLoggerWriter = new BatchTextWriter(path, false);
return RawLoggerWriter != NULL;
}
示例6: CalculateAzimuth
Angle
SunEphemeris::CalcAzimuth(const GeoPoint &location,
const BrokenDateTime &date_time,
const fixed time_zone)
{
assert(date_time.Plausible());
fixed days_to_j2000 = FNday(date_time);
Angle l = GetMeanSunLongitude(days_to_j2000);
// Use GetEclipticLongitude to find the ecliptic longitude of the Sun
Angle lambda = GetEclipticLongitude(days_to_j2000, l);
// Obliquity of the ecliptic
Angle obliquity = Angle::Degrees(fixed(23.439) - fixed(.0000004) * days_to_j2000);
// Find the DEC of the Sun
Angle delta = Angle::asin(obliquity.sin() * lambda.sin());
return CalculateAzimuth(location, date_time, time_zone, delta);
}
示例7: assert
bool
NMEALogger::Start()
{
if (writer != NULL)
return true;
BrokenDateTime dt = XCSoarInterface::Basic().date_time_utc;
assert(dt.Plausible());
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 BatchTextWriter(path, false);
return writer != NULL;
}
示例8: assert
SunEphemeris::Result
SunEphemeris::CalcSunTimes(const GeoPoint &location,
const BrokenDateTime &date_time,
const fixed time_zone)
{
Result result;
assert(date_time.Plausible());
fixed days_to_j2000 = FNday(date_time);
Angle l = GetMeanSunLongitude(days_to_j2000);
// Use GetEclipticLongitude to find the ecliptic longitude of the Sun
Angle lambda = GetEclipticLongitude(days_to_j2000, l);
// Obliquity of the ecliptic
Angle obliquity = Angle::Degrees(fixed(23.439) - fixed(.0000004) * days_to_j2000);
// Find the RA and DEC of the Sun
Angle alpha = Angle::FromXY(lambda.cos(), obliquity.cos() * lambda.sin());
Angle delta = Angle::asin(obliquity.sin() * lambda.sin());
// Find the Equation of Time in minutes
// Correction suggested by David Smith
fixed ll = (l - alpha).Radians();
if (l.Radians() < fixed_pi)
ll += fixed_two_pi;
fixed equation = fixed(1440) * (fixed(1) - ll / fixed_two_pi);
Angle hour_angle = GetHourAngle(location.latitude, delta);
Angle hour_angle_twilight = GetHourAngleTwilight(location.latitude, delta);
result.azimuth = CalculateAzimuth(location, date_time, time_zone, delta);
// length of twilight in hours
fixed twilight_hours = (hour_angle_twilight - hour_angle).Hours();
// Conversion of angle to hours and minutes
result.day_length = Double(hour_angle.Hours());
if (result.day_length < fixed(0.0001))
// arctic winter
result.day_length = fixed(0);
result.time_of_sunrise = fixed(12) - hour_angle.Hours() + time_zone
- location.longitude.Degrees() / 15 + equation / 60;
if (result.time_of_sunrise > fixed(24))
result.time_of_sunrise -= fixed(24);
result.time_of_sunset = result.time_of_sunrise + result.day_length;
result.time_of_noon = result.time_of_sunrise + hour_angle.Hours();
// morning twilight begin
result.morning_twilight = result.time_of_sunrise - twilight_hours;
// evening twilight end
result.evening_twilight = result.time_of_sunset + twilight_hours;
return result;
}