MythTV
master
|
A QElapsedTimer based timer to replace use of QTime as a timer. More...
#include <mythtimer.h>
Public Types | |
enum | StartState { kStartRunning, kStartInactive } |
Public Member Functions | |
MythTimer (StartState state=kStartInactive) | |
Creates a timer. More... | |
void | start (void) |
starts measuring elapsed time. More... | |
std::chrono::milliseconds | restart (void) |
Returns milliseconds elapsed since last start() or restart() and resets the count. More... | |
void | stop (void) |
Stops timer, next call to isRunning() will return false and any calls to elapsed() or restart() will return 0 until after timer is restarted by a call to start() or restart(). More... | |
void | addMSecs (std::chrono::milliseconds ms) |
Adds an offset to the last call to start() or restart(). More... | |
std::chrono::milliseconds | elapsed (void) |
Returns milliseconds elapsed since last start() or restart() More... | |
std::chrono::nanoseconds | nsecsElapsed (void) const |
Returns nanoseconds elapsed since last start() or restart() More... | |
bool | isRunning (void) const |
Returns true if start() or restart() has been called at least once since construction and since any call to stop(). More... | |
Private Attributes | |
QElapsedTimer | m_timer |
std::chrono::milliseconds | m_offset {0ms} |
A QElapsedTimer based timer to replace use of QTime as a timer.
This class is not thread-safe.
Definition at line 13 of file mythtimer.h.
Enumerator | |
---|---|
kStartRunning | |
kStartInactive |
Definition at line 16 of file mythtimer.h.
|
explicit |
Creates a timer.
If a start state of kStartRunning is passed in the timer is started immediately as if start() had been called.
Definition at line 38 of file mythtimer.cpp.
void MythTimer::start | ( | void | ) |
starts measuring elapsed time.
Definition at line 47 of file mythtimer.cpp.
Referenced by DTVRecorder::BufferedWrite(), GUIStartup::Close(), DVBStreamHandler::CycleFiltersByPriority(), MythContextPrivate::DefaultUPnP(), ThreadedFileWriter::DiskLoop(), TV::DoSeek(), elapsed(), FreeSpaceUpdater::FreeSpaceUpdater(), AnalogSignalMonitor::handleHDPVR(), MythTimer(), MythUITextEdit::MythUITextEdit(), AudioOutputOSS::OpenDevice(), MythFileBuffer::OpenFile(), MythPlayer::OpenFile(), PlayerContext::PlayerContext(), DeviceReadBuffer::Poll(), SatIP::probeDevices(), VBox::probeDevices(), DarwinFirewireDevice::ProcessNoDataMessage(), MPEGStreamData::ProcessPAT(), DTVRecorder::ProcessTSPacket(), RemoteFile::Read(), BufferedSocketDeviceRequest::ReadBlock(), ZMClient::readData(), MythMediaBuffer::ReadDirect(), BufferedSocketDevice::ReadLine(), BufferedSocketDeviceRequest::ReadLine(), MythSocket::ReadStringListReal(), MythCommFlagPlayer::RebuildSeekTable(), DeviceReadBuffer::ReportStats(), restart(), MpegRecorder::run(), ExternalStreamHandler::run(), MythCCExtractorPlayer::run(), MythMediaBuffer::run(), FirewireSignalMonitor::RunTableMonitor(), RecorderBase::SavePositionMap(), DecoderBase::SavePositionMapDelta(), DeviceReadBuffer::Setup(), LinuxFirewireDevice::SignalReset(), V4L2encSignalMonitor::StableResolution(), HTTPLiveStream::StartStream(), HTTPLiveStream::StopStream(), TV::TV(), TV::UpdateOSDSignal(), FirewireSignalMonitor::UpdateValues(), MythContextPrivate::UPnPautoconf(), MythMediaBuffer::WaitForAvail(), TVRec::WaitForEventThreadSleep(), MythMediaBuffer::WaitForReadsAllowed(), DeviceReadBuffer::WaitForUsed(), and MythSocket::WriteStringListReal().
std::chrono::milliseconds MythTimer::restart | ( | void | ) |
Returns milliseconds elapsed since last start() or restart() and resets the count.
Definition at line 62 of file mythtimer.cpp.
Referenced by DTVRecorder::BufferedWrite(), MythDVDPlayer::ChangeSpeed(), RecorderBase::CheckForRingBufferSwitch(), ThreadedFileWriter::DiskLoop(), DTVRecorder::FindH2645Keyframes(), RemoteEncoder::GetFramesWritten(), RemoteFile::GetRealFileSize(), FreeSpaceUpdater::KeepRunning(), MythUITextEdit::keyPressEvent(), MythCommFlagPlayer::RebuildSeekTable(), ExternalStreamHandler::run(), MythCCExtractorPlayer::run(), MythDVDPlayer::SetStillFrameTimeout(), and MythSocket::WriteStringListReal().
void MythTimer::stop | ( | void | ) |
Stops timer, next call to isRunning() will return false and any calls to elapsed() or restart() will return 0 until after timer is restarted by a call to start() or restart().
Definition at line 78 of file mythtimer.cpp.
Referenced by GUIStartup::Close(), DTVRecorder::FindH2645Keyframes(), AnalogSignalMonitor::handleHDPVR(), MythTimer(), ExternalStreamHandler::run(), and V4L2encSignalMonitor::StableResolution().
void MythTimer::addMSecs | ( | std::chrono::milliseconds | ms | ) |
Adds an offset to the last call to start() or restart().
This offset is removed if start() or restart() is called again. The offset may be positive or negative. This may be called multiple times to accrete various offsets.
Definition at line 146 of file mythtimer.cpp.
Referenced by MythDVDPlayer::ChangeSpeed(), GUIStartup::Close(), PlayerContext::PlayerContext(), and DTVRecorder::ProcessTSPacket().
std::chrono::milliseconds MythTimer::elapsed | ( | void | ) |
Returns milliseconds elapsed since last start() or restart()
Definition at line 91 of file mythtimer.cpp.
Referenced by TV::ActiveHandleAction(), HEVCParser::addBytes(), MythDVDPlayer::ChangeSpeed(), PortChecker::checkPort(), GUIStartup::Close(), DVBStreamHandler::CycleFiltersByPriority(), MythContextPrivate::DefaultUPnP(), ThreadedFileWriter::DiskLoop(), TV::DoSeek(), DTVRecorder::FindH2645Keyframes(), RemoteEncoder::GetFramesWritten(), MythDVDPlayer::GetMillisecondsPlayed(), RemoteFile::GetRealFileSize(), AnalogSignalMonitor::handleHDPVR(), FirewireSignalMonitor::HandlePAT(), AudioOutputOSS::OpenDevice(), MythFileBuffer::OpenFile(), MythPlayer::OpenFile(), DeviceReadBuffer::Poll(), SatIP::probeDevices(), VBox::probeDevices(), DarwinFirewireDevice::ProcessNoDataMessage(), MPEGStreamData::ProcessPAT(), DTVRecorder::ProcessTSPacket(), ExternalStreamHandler::ProcessVer1(), ExternalStreamHandler::ProcessVer2(), progress_string(), MythUITextEdit::Pulse(), RemoteFile::Read(), BufferedSocketDeviceRequest::ReadBlock(), ZMClient::readData(), MythMediaBuffer::ReadDirect(), BufferedSocketDevice::ReadLine(), BufferedSocketDeviceRequest::ReadLine(), MythMediaBuffer::ReadPriv(), MythSocket::ReadStringListReal(), MythCommFlagPlayer::RebuildSeekTable(), DeviceReadBuffer::ReportStats(), MpegRecorder::run(), LinuxFirewireDevice::run(), ExternalStreamHandler::run(), MythCCExtractorPlayer::run(), MythMediaBuffer::run(), FreeSpaceUpdater::run(), RecorderBase::SavePositionMap(), DecoderBase::SavePositionMapDelta(), AvFormatDecoder::SeekReset(), V4L2encSignalMonitor::StableResolution(), HTTPLiveStream::StartStream(), MythDVDPlayer::StillFrameCheck(), HTTPLiveStream::StopStream(), StreamHandler::UpdateFiltersFromStreamData(), TV::UpdateOSDSignal(), GUIStartup::updateProgress(), FirewireSignalMonitor::UpdateValues(), MythContextPrivate::UPnPautoconf(), MythMediaBuffer::WaitForAvail(), TVRec::WaitForEventThreadSleep(), MythMediaBuffer::WaitForReadsAllowed(), DeviceReadBuffer::WaitForUsed(), and MythSocket::WriteStringListReal().
std::chrono::nanoseconds MythTimer::nsecsElapsed | ( | void | ) | const |
Returns nanoseconds elapsed since last start() or restart()
Definition at line 119 of file mythtimer.cpp.
bool MythTimer::isRunning | ( | void | ) | const |
Returns true if start() or restart() has been called at least once since construction and since any call to stop().
Definition at line 135 of file mythtimer.cpp.
Referenced by DTVRecorder::FindH2645Keyframes(), RemoteEncoder::GetFramesWritten(), RemoteFile::GetRealFileSize(), AnalogSignalMonitor::handleHDPVR(), ExternalStreamHandler::run(), RecorderBase::SavePositionMap(), V4L2encSignalMonitor::StableResolution(), StreamHandler::UpdateFiltersFromStreamData(), and TV::UpdateOSDSignal().
|
private |
Definition at line 34 of file mythtimer.h.
Referenced by elapsed(), isRunning(), nsecsElapsed(), restart(), start(), and stop().
|
private |
Definition at line 35 of file mythtimer.h.
Referenced by addMSecs(), elapsed(), nsecsElapsed(), restart(), and start().