Ticket #3310: housekeeper.diff

File housekeeper.diff, 3.3 KB (added by wp.van.paassen@…, 17 years ago)

vsn diff for file housekeeping.cpp in mythtv/programs/mythtvbackend

  • mythtv/programs/mythbackend/housekeeper.cpp

     /* vim: set expandtab tabstop=4 shiftwidth=4: */
     
    6464        minhour = 0;
    6565    if (maxhour > 23)
    6666        maxhour = 23;
    67     if (minhour > maxhour)
    68     {
    69         VERBOSE(VB_GENERAL,
    70             "Housekeeping thread will not run: supplied time range is empty");
    71     }
    7267
    7368    MSqlQuery result(MSqlQuery::InitCon());
    7469    if (result.isConnected())
     
    8681                     lastrun.toString(QString("d")).toInt()))
    8782            {
    8883                int hour = now.toString(QString("h")).toInt();
    89                 if ((hour >= minhour) && (hour <= maxhour))
     84               
     85                if (minhour > maxhour)
    9086                {
    91                     int minute = now.toString(QString("m")).toInt();
    92                     if ((hour == maxhour && minute > 30) ||
    93                         ((random()%(((maxhour-hour)*12+(60-minute)/5 - 6) + 1)) == 0))
    94                         runOK = true;
     87                    if((hour <= maxhour) ||
     88                        (hour > maxhour && minhour <= hour))
     89                    {
     90                        int minute = now.toString(QString("m")).toInt();
     91                        if ((hour == maxhour && minute > 30) ||
     92                            ((random()%(((maxhour-hour)*12+(60-minute)/5 - 6) + 1)) == 0))
     93                            runOK = true;
     94                    }
    9595                }
     96                else
     97                {
     98                    if ((hour >= minhour) && (hour <= maxhour))
     99                    {
     100                        int minute = now.toString(QString("m")).toInt();
     101                        if ((hour == maxhour && minute > 30) ||
     102                            ((random()%(((maxhour-hour)*12+(60-minute)/5 - 6) + 1)) == 0))
     103                            runOK = true;
     104                    }
     105                }
    96106            }
    97107        }
    98108        else
     
    223233                        QDateTime now = QDateTime::currentDateTime();
    224234                        int hour = now.toString(QString("h")).toInt();
    225235
    226                         if ((nextRun < now) &&
    227                             (lastRun.secsTo(now) > (3 * 60 * 60)) &&
    228                             ((minhr <= hour) && (hour <= maxhr)))
    229                             runMythFill = true;
     236                        //passing midnight in interval
     237                        if (minhr > maxhr)
     238                        {
     239                            if ((nextRun < now) &&
     240                                (lastRun.secsTo(now) > (3 * 60 * 60)) &&
     241                                ((hour <= maxhr) ||
     242                                ((hour > maxhr) && (minhr <= hour))))
     243                                runMythFill = true;
     244                        }
     245                        else
     246                        {
     247                            if ((nextRun < now) &&
     248                                (lastRun.secsTo(now) > (3 * 60 * 60)) &&
     249                                ((minhr <= hour) && (hour <= maxhr)))
     250                                runMythFill = true;
     251                        }
    230252                    }
    231253                    else if (wantToRun("MythFillDB", period, minhr, maxhr))
    232254                    {