StelUtils.cpp   StelUtils.cpp 
skipping to change at line 59 skipping to change at line 59
{ {
#if defined(STELLARIUM_VERSION) #if defined(STELLARIUM_VERSION)
return QString(STELLARIUM_VERSION); return QString(STELLARIUM_VERSION);
#elif defined(BZR_REVISION) #elif defined(BZR_REVISION)
return QString("%1.%2 [%3]").arg(PACKAGE_VERSION).arg(BZR_REVISION). arg(BZR_BRANCH); return QString("%1.%2 [%3]").arg(PACKAGE_VERSION).arg(BZR_REVISION). arg(BZR_BRANCH);
#else #else
return QString(PACKAGE_VERSION); return QString(PACKAGE_VERSION);
#endif #endif
} }
QString getUserAgentString()
{
// Get info about operating system
QString platform = StelUtils::getOperatingSystemInfo();
if (platform.contains("Linux"))
platform = "Linux";
if (platform.contains("FreeBSD"))
platform = "FreeBSD";
if (platform.contains("NetBSD"))
platform = "NetBSD";
if (platform.contains("OpenBSD"))
platform = "OpenBSD";
// Set user agent as "Stellarium/$version$ ($platform$)"
return QString("Stellarium/%1 (%2)").arg(StelUtils::getApplicationVe
rsion()).arg(platform);
}
QString getOperatingSystemInfo() QString getOperatingSystemInfo()
{ {
QString OS = "Unknown operating system"; QString OS = "Unknown operating system";
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
switch(QSysInfo::WindowsVersion) switch(QSysInfo::WindowsVersion)
{ {
case QSysInfo::WV_95: case QSysInfo::WV_95:
OS = "Windows 95"; OS = "Windows 95";
break; break;
skipping to change at line 942 skipping to change at line 959
} }
QTime jdFractionToQTime(const double jd) QTime jdFractionToQTime(const double jd)
{ {
double decHours = std::fmod(jd+0.5, 1.0); double decHours = std::fmod(jd+0.5, 1.0);
int hours = (int)(decHours/0.041666666666666666666); int hours = (int)(decHours/0.041666666666666666666);
int mins = (int)((decHours-(hours*0.041666666666666666666))/0.000694 44444444444444444); int mins = (int)((decHours-(hours*0.041666666666666666666))/0.000694 44444444444444444);
return QTime::fromString(QString("%1.%2").arg(hours).arg(mins), "h.m "); return QTime::fromString(QString("%1.%2").arg(hours).arg(mins), "h.m ");
} }
// Use Qt's own sense of time and offset instead of platform specific code.
float getGMTShiftFromQT(const double JD)
{
int year, month, day, hour, minute, second;
getDateFromJulianDay(JD, &year, &month, &day);
getTimeFromJulianDay(JD, &hour, &minute, &second);
// as analogous to second statement in getJDFromDate, nkerr
if ( year <= 0 )
{
year = year - 1;
}
//getTime/DateFromJulianDay returns UTC time, not local time
QDateTime universal(QDate(year, month, day), QTime(hour, minute, sec
ond), Qt::UTC);
if (! universal.isValid())
{
//qWarning() << "JD " << QString("%1").arg(JD) << " out of b
ounds of QT help with GMT shift, using current datetime";
// Assumes the GMT shift was always the same before year -47
10
universal = QDateTime(QDate(-4710, month, day), QTime(hour,
minute, second), Qt::UTC);
}
QDateTime local = universal.toLocalTime();
//Both timezones should be interpreted as UTC because secsTo() conve
rts both
//times to UTC if their zones have different daylight saving time ru
les.
local.setTimeSpec(Qt::UTC);
int shiftInSeconds = universal.secsTo(local);
float shiftInHours = shiftInSeconds / 3600.0f;
return shiftInHours;
}
// UTC ! // UTC !
bool getJDFromDate(double* newjd, const int y, const int m, const int d, co nst int h, const int min, const int s) bool getJDFromDate(double* newjd, const int y, const int m, const int d, co nst int h, const int min, const int s)
{ {
static const long IGREG2 = 15+31L*(10+12L*1582); static const long IGREG2 = 15+31L*(10+12L*1582);
double deltaTime = (h / 24.0) + (min / (24.0*60.0)) + (s / (24.0 * 6 0.0 * 60.0)) - 0.5; double deltaTime = (h / 24.0) + (min / (24.0*60.0)) + (s / (24.0 * 6 0.0 * 60.0)) - 0.5;
QDate test((y <= 0 ? y-1 : y), m, d); QDate test((y <= 0 ? y-1 : y), m, d);
// if QDate will oblige, do so. // if QDate will oblige, do so.
// added hook for Julian calendar, because he has been removed from Qt5 --AW // added hook for Julian calendar, because he has been removed from Qt5 --AW
if ( test.isValid() && y>1582) if ( test.isValid() && y>1582)
{ {
skipping to change at line 1126 skipping to change at line 1114
break; break;
} }
return 0; return 0;
} }
//! given the submitted year/month/day hour:minute:second, try to //! given the submitted year/month/day hour:minute:second, try to
//! normalize into an actual year/month/day. values can be positive, 0, //! normalize into an actual year/month/day. values can be positive, 0,
//! or negative. start assessing from seconds to larger increments. //! or negative. start assessing from seconds to larger increments.
bool changeDateTimeForRollover(int oy, int om, int od, int oh, int omin, in t os, bool changeDateTimeForRollover(int oy, int om, int od, int oh, int omin, in t os,
int* ry, int* rm, int* rd, int* rh, int* rmi n, int* rs) int* ry, int* rm, int* rd, int* rh, int* rmin , int* rs)
{ {
bool change = false; bool change = false;
while ( os > 59 ) { while ( os > 59 ) {
os -= 60; os -= 60;
omin += 1; omin += 1;
change = true; change = true;
} }
while ( os < 0 ) { while ( os < 0 ) {
os += 60; os += 60;
skipping to change at line 1940 skipping to change at line 1928
else else
{ {
k = 0.0; a0 = 0.0; a1 = 0.0; a2 = 0.0; a3 = 0.0; a4 = 0.0; k = 0.0; a0 = 0.0; a1 = 0.0; a2 = 0.0; a3 = 0.0; a4 = 0.0;
} }
double u = k + (year - 2000)/100; double u = k + (year - 2000)/100;
return (((a4*u + a3)*u + a2)*u + a1)*u + a0; return (((a4*u + a3)*u + a2)*u + a1)*u + a0;
} }
double getMoonSecularAcceleration(const double jDay, const double nd) double getMoonSecularAcceleration(const double jDay, const double nd, const bool useDE43x)
{ {
int year, month, day; int year, month, day;
getDateFromJulianDay(jDay, &year, &month, &day); getDateFromJulianDay(jDay, &year, &month, &day);
double t = (getDecYear(year, month, day)-1955.5)/100.0; double t = (getDecYear(year, month, day)-1955.5)/100.0;
// n.dot for secular acceleration of the Moon in ELP2000-82B // n.dot for secular acceleration of the Moon in ELP2000-82B
// have value -23.8946 "/cy/cy // have value -23.8946 "/cy/cy (or -25.8 for DE43x usage)
return -0.91072 * (-23.8946 + qAbs(nd))*t*t; double ephND = -23.8946;
if (useDE43x)
ephND = -25.8;
return -0.91072 * (ephND + qAbs(nd))*t*t;
} }
double getDeltaTStandardError(const double jDay) double getDeltaTStandardError(const double jDay)
{ {
int year, month, day; int year, month, day;
getDateFromJulianDay(jDay, &year, &month, &day); getDateFromJulianDay(jDay, &year, &month, &day);
double sigma = -1.; double sigma = -1.;
if (-1000 <= year && year <= 1600) if (-1000 <= year && year <= 1600)
 End of changes. 5 change blocks. 
39 lines changed or deleted 26 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/