StelUtils.cpp   StelUtils.cpp
skipping to change at line 331 skipping to change at line 331
else if (m!=0) else if (m!=0)
{ {
ts << m << 'm'; ts << m << 'm';
} }
return buf; return buf;
} }
/************************************************************************* /*************************************************************************
Convert an angle in radian to a hms formatted string Convert an angle in radian to a hms formatted string
If decimal is true, output should be like this: " 16h29m55.3s" If decimal is true, output should be like this: " 16h29m55.3s"
If decimal is true, output should be like this: " 16h20m0.4s" If decimal is true, output should be like this: " 16h20m00.4s"
If decimal is false, output should be like this: "0h26m5s" If decimal is false, output should be like this: "0h26m5s"
*************************************************************************/ *************************************************************************/
QString radToHmsStr(const double angle, const bool decimal) QString radToHmsStr(const double angle, const bool decimal)
{ {
unsigned int h,m; unsigned int h,m;
double s; double s;
StelUtils::radToHms(angle+0.005*M_PI/12/(60*60), h, m, s); StelUtils::radToHms(angle+0.005*M_PI/12/(60*60), h, m, s);
int width, precision; int width, precision;
QString carry; QString carry, r;
if (decimal) if (decimal)
{ {
width=5; width=5;
precision=2; precision=2;
carry="60.00"; carry="60.00";
} }
else else
{ {
width=4; width=4;
precision=1; precision=1;
skipping to change at line 368 skipping to change at line 368
m+=1; m+=1;
} }
if (m==60) if (m==60)
{ {
m=0; m=0;
h+=1; h+=1;
} }
if (h==24 && m==0 && s==0) if (h==24 && m==0 && s==0)
h=0; h=0;
return QString("%1h%2m%3s").arg(h, width).arg(m,); return QString("%1h%2m%3s").arg(h, width).arg(m, 2, 10, QChar('0')). arg(s, 3+precision, 'f', precision, QChar('0'));
} }
/************************************************************************* /*************************************************************************
Convert an angle in radian to a dms formatted string Convert an angle in radian to a dms formatted string
If the minute and second part are null are too small, don't print them If the minute and second part are null are too small, don't print them
*************************************************************************/ *************************************************************************/
QString radToDmsStrAdapt(const double angle, const bool useD) QString radToDmsStrAdapt(const double angle, const bool useD)
{ {
QChar degsign('d'); QChar degsign('d');
if (!useD) if (!useD)
skipping to change at line 2430 skipping to change at line 2430
} }
double getDecYear(const int year, const int month, const int day) double getDecYear(const int year, const int month, const int day)
{ {
return year+((month-1)*30.5+day/31.*30.5)/366; return year+((month-1)*30.5+day/31.*30.5)/366;
} }
int compareVersions(const QString v1, const QString v2) int compareVersions(const QString v1, const QString v2)
{ {
// result (-1: v1<v2; 0: v1==v2; 1: v1>v2) // result (-1: v1<v2; 0: v1==v2; 1: v1>v2)
int result = 0; int ver1, ver2, result = 0;
QStringList v1s = v1.split("."); QStringList v1s = v1.split(".");
QStringList v2s = v2.split("."); QStringList v2s = v2.split(".");
ver1 = v1s.at(0).toInt()*1000 + v1s.at(1).toInt()*100 + if (v1s.count(".")==2) // Full format: X.Y.Z
ver1 = v1s.at(0).toInt()*1000 + v1s.at(1).toInt()*100 + v1s.
ver2 = v2s.at(0).toInt()*1000 + v2s.at(1).toInt()*100 + at(2).toInt();
else // Short format: X.Y
ver1 = v1s.at(0).toInt()*1000 + v1s.at(1).toInt()*100;
if (v2s.count(".")==2)
ver2 = v2s.at(0).toInt()*1000 + v2s.at(1).toInt()*100 + v2s.
at(2).toInt();
else
ver2 = v2s.at(0).toInt()*1000 + v2s.at(1).toInt()*100;
if (ver1<ver2) if (ver1<ver2)
result = -1; result = -1;
else if (ver1 == ver2) else if (ver1 == ver2)
result = 0; result = 0;
else if (ver1 > ver2) else if (ver1 > ver2)
result = 1; result = 1;
return result; return result;
} }
End of changes. 5 change blocks.
8 lines changed or deleted 15 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/