fixed hours() related hang

This commit is contained in:
Mark Watkins 2011-07-03 02:07:38 +10:00
parent ba7ce7123d
commit f0f6232c8a
4 changed files with 11 additions and 4 deletions

View File

@ -68,7 +68,9 @@ void gYAxis::Plot(gGraphWindow &w,float scrx,float scry)
glColor4ub(linecol1.red(),linecol1.green(),linecol1.blue(),linecol1.alpha());
glLineWidth(1);
if (min_ytick>=1000000) {
min_ytick=100;
}
for (double i=miny+(min_ytick/2.0); i<maxy; i+=min_ytick) {
ty=(i - miny) * ymult;

View File

@ -373,7 +373,12 @@ void HistoryData::ResetDateRange()
}
double HistoryData::Calc(Day *day)
{
return (day->summary_sum(CPAP_Obstructive) + day->summary_sum(CPAP_Hypopnea) + day->summary_sum(CPAP_ClearAirway)) / day->hours();
double h=day->hours();
double ahi=(day->summary_sum(CPAP_Obstructive) + day->summary_sum(CPAP_Hypopnea) + day->summary_sum(CPAP_ClearAirway)) / h;
if (ahi>1000) {
ahi=999;
}
return ahi;
}
void HistoryData::Reload(Day *day)

View File

@ -46,7 +46,7 @@ public:
qint64 last() { return d_last; };
qint64 total_time(); // in milliseconds
float hours() { return total_time()/3600000.0; };
double hours() { return double(total_time())/3600000.0; };
Session *operator [](int i) { return sessions[i]; };

View File

@ -554,7 +554,7 @@ void Daily::Load(QDate date)
QDateTime date=QDateTime::fromMSecsSinceEpoch(cpap->first());
QDateTime date2=QDateTime::fromMSecsSinceEpoch(cpap->last());
html+="<tr><td align='center'>"+date.toString(Qt::SystemLocaleShortDate)+"</td><td align='center'>"+date.toString("HH:mm")+"</td><td align='center'>"+date2.toString("HH:mm")+"</td><td align='center'>"+a.sprintf("%02i:%02i",tt/3600,tt%60)+"</td></tr>\n";
html+="<tr><td align='center'>"+date.date().toString(Qt::SystemLocaleShortDate)+"</td><td align='center'>"+date.toString("HH:mm")+"</td><td align='center'>"+date2.toString("HH:mm")+"</td><td align='center'>"+a.sprintf("%02i:%02i",tt/3600,tt%60)+"</td></tr>\n";
html+="<tr><td colspan=4 align=center><hr></td></tr>\n";
QString cs;