Ticket #11255: mythtv_mythtimer_use_monotonic_clock.patch

File mythtv_mythtimer_use_monotonic_clock.patch, 1.2 KB (added by Rune Petersen <rune@…>, 11 years ago)
  • mythtv/libs/libmythbase/mythtimer.h

    diff --git a/mythtv/libs/libmythbase/mythtimer.h b/mythtv/libs/libmythbase/mythtimer.h
    index fe7373f..3a0c55d 100644
    a b  
    11#ifndef MYTHTIMER_H_
    22#define MYTHTIMER_H_
    33
    4 #include <QTime>
     4#include <QElapsedTimer>
    55#include "mythbaseexp.h"
    66
    77class MBASE_PUBLIC MythTimer
    88{
    99  public:
    10     MythTimer() : m_running(false) {}
     10    MythTimer() {}
    1111
    12     void start() { m_running = true; m_timer.start(); }
     12    void start() { m_timer.start(); }
    1313    int restart() { int ret = elapsed();
    1414                    m_timer.restart();
    1515                    return ret;
    1616                  }
    17     int elapsed() { int ret = m_timer.elapsed();
    18                     if (ret > 86300000) { ret = 0;  m_timer.restart(); }
    19                     return ret;
    20                   }
    21     void stop() { m_running = false; }
    22     bool isRunning() const { return m_running; }
     17    int elapsed() { return m_timer.elapsed(); }
     18    void stop() { m_timer.invalidate(); }
     19    bool isRunning() const { return m_timer.isValid(); }
    2320
    24     void addMSecs(int ms) { m_timer.addMSecs(ms); }
     21    void addMSecs(int ms) { }
    2522
    2623  private:
    27     QTime m_timer;
    28     bool  m_running;
     24    QElapsedTimer m_timer;
    2925};
    3026
    3127#endif