6 changes: 3 additions & 3 deletions mythtv/libs/libmythtv/DVD/mythdvdbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ void MythDVDBuffer::WaitForPlayer(void)
while (m_playerWait && count++ < 200)
{
m_rwLock.unlock();
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
m_rwLock.lockForWrite();
}

Expand Down Expand Up @@ -998,7 +998,7 @@ int MythDVDBuffer::SafeRead(void *Buffer, uint Size)
// pause a little as the dvdnav VM will continue to return
// this event until it has been skipped
m_rwLock.unlock();
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
m_rwLock.lockForWrite();

// when scanning the file or exiting playback, skip immediately
Expand Down Expand Up @@ -1054,7 +1054,7 @@ int MythDVDBuffer::SafeRead(void *Buffer, uint Size)
{
m_dvdWaiting = true;
m_rwLock.unlock();
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
m_rwLock.lockForWrite();
}

Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/DVD/mythdvdplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ bool MythDVDPlayer::VideoLoop(void)
if (nbframes == 0)
{
LOG(VB_PLAYBACK, LOG_WARNING, LOC + "In DVD Menu: No video frames in queue");
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
return !IsErrored();
}

Expand Down Expand Up @@ -291,7 +291,7 @@ void MythDVDPlayer::InitialSeek(void)
m_decodeOneFrame = true;
int count = 0;
while (count++ < 100 && m_decodeOneFrame)
std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::this_thread::sleep_for(50ms);
}
MythPlayerUI::InitialSeek();
m_playerCtx->m_buffer->IgnoreWaitStates(false);
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/decoders/avformatdecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ void AvFormatDecoder::SeekReset(long long newKey, uint skipFrames,
retry = false;
GetFrame(kDecodeVideo, retry);
if (retry)
std::this_thread::sleep_for(std::chrono::milliseconds(1));
std::this_thread::sleep_for(1ms);
}

if (m_decodedVideoFrame)
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/io/mythmediabuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ void MythMediaBuffer::run(void)
// like us, yield (currently implemented with short usleep).
m_generalWait.wakeAll();
m_rwLock.unlock();
std::this_thread::sleep_for(std::chrono::milliseconds(5));
std::this_thread::sleep_for(5ms);
m_rwLock.lockForRead();
}
else
Expand All @@ -1125,7 +1125,7 @@ void MythMediaBuffer::run(void)
// reader gets a chance to read before the buffer is full.
m_generalWait.wakeAll();
m_rwLock.unlock();
std::this_thread::sleep_for(std::chrono::milliseconds(5));
std::this_thread::sleep_for(5ms);
m_rwLock.lockForRead();
}
}
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ bool MPEGStreamData::ProcessTSPacket(const TSPacket& tspacket)
QString("PID %1 (0x%2) has PCR %3μs")
.arg(m_pmtSingleProgram->PCRPID())
.arg(m_pmtSingleProgram->PCRPID(), 0, 16)
.arg(std::chrono::duration_cast<std::chrono::microseconds>
.arg(duration_cast<std::chrono::microseconds>
(tspacket.GetPCR().time_since_epoch()).count()));
}
}
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/mythcommflagplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ bool MythCommFlagPlayer::RebuildSeekTable(bool ShowPercentage, StatusCallback Ca
{
// Give DB some breathing room if it gets far behind..
if (myFramesPlayed - pmap_last > 5000)
std::this_thread::sleep_for(std::chrono::milliseconds(200));
std::this_thread::sleep_for(200ms);

// If we're already saving, just save a larger block next time..
if (MythRebuildSaver::GetCount(m_decoder) < 1)
Expand Down Expand Up @@ -243,7 +243,7 @@ MythVideoFrame* MythCommFlagPlayer::GetRawVideoFrame(long long FrameNumber)
while (!m_videoOutput->ValidVideoFrames() && ((tries++) < 100))
{
m_decodeOneFrame = true;
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
if ((tries & 10) == 10)
LOG(VB_PLAYBACK, LOG_INFO, LOC + "Waited 100ms for video frame");
}
Expand Down
10 changes: 5 additions & 5 deletions mythtv/libs/libmythtv/mythplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ int MythPlayer::OpenFile(int Retries)
return -1;
}
LOG(VB_GENERAL, LOG_WARNING, LOC + "OpenFile() waiting on data");
std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::this_thread::sleep_for(50ms);
}

m_playerCtx->LockPlayingInfo(__FILE__, __LINE__);
Expand Down Expand Up @@ -1092,7 +1092,7 @@ void MythPlayer::DecoderLoop(bool pause)

if (m_totalDecoderPause || m_inJumpToProgramPause)
{
std::this_thread::sleep_for(std::chrono::milliseconds(1));
std::this_thread::sleep_for(1ms);
continue;
}

Expand Down Expand Up @@ -1130,7 +1130,7 @@ void MythPlayer::DecoderLoop(bool pause)
if (m_isDummy || ((m_decoderPaused || m_ffrewSkip == 0 || obey_eof) &&
!m_decodeOneFrame))
{
std::this_thread::sleep_for(std::chrono::milliseconds(1));
std::this_thread::sleep_for(1ms);
continue;
}

Expand Down Expand Up @@ -1207,7 +1207,7 @@ bool MythPlayer::DecoderGetFrame(DecodeType decodetype, bool unsafe)
}
return false;
}
std::this_thread::sleep_for(std::chrono::milliseconds(1));
std::this_thread::sleep_for(1ms);
}
m_videobufRetries = 0;

Expand Down Expand Up @@ -1618,7 +1618,7 @@ void MythPlayer::WaitForSeek(uint64_t frame, uint64_t seeksnap_wanted)
emit CheckCallbacks();

// Wait a little
std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::this_thread::sleep_for(50ms);

// provide some on screen feedback if seeking is slow
count++;
Expand Down
2 changes: 0 additions & 2 deletions mythtv/libs/libmythtv/mythplayeroverlayui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include "livetvchain.h"
#include "mythplayeroverlayui.h"

using namespace std::chrono_literals;

#define LOC QString("PlayerOverlay: ")

// N.B. Overlay is initialised without a player - it must be set before it can be used
Expand Down
4 changes: 0 additions & 4 deletions mythtv/libs/libmythtv/mythplayerui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
#include "livetvchain.h"
#include "mythplayerui.h"

// Std
#include <chrono>
using namespace std::chrono_literals;

#define LOC QString("PlayerUI: ")

MythPlayerUI::MythPlayerUI(MythMainWindow* MainWindow, TV* Tv,
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/opengl/mythnvdecinterop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ bool MythNVDECInterop::CreateCUDAContext(MythRenderOpenGL* GLContext, CudaFuncti
if (!retry)
break;
LOG(VB_GENERAL, LOG_WARNING, LOC + "Will retry in 50ms");
std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::this_thread::sleep_for(50ms);
}
return false;
}
Expand Down
24 changes: 12 additions & 12 deletions mythtv/libs/libmythtv/recorders/ExternalStreamHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ int ExternIO::Read(QByteArray & buffer, int maxlen, int timeout)
LOG(VB_RECORD, LOG_WARNING,
QString("External Recorder not ready. Will retry (%1/%2).")
.arg(m_errCnt).arg(kMaxErrorCnt));
std::this_thread::sleep_for(std::chrono::milliseconds(100));
std::this_thread::sleep_for(100ms);
}
}
else
Expand Down Expand Up @@ -275,7 +275,7 @@ bool ExternIO::KillIfRunning(const QString & cmd)
return true;
}

std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::this_thread::sleep_for(50ms);

kil = QString("pkill --signal 9 -x -f \"%1\" 2>&1 > /dev/null").arg(cmd);
res_kil = system(kil.toUtf8().constData());
Expand Down Expand Up @@ -307,7 +307,7 @@ void ExternIO::Fork(void)
if (!KillIfRunning(full_command))
{
// Give it one more chance.
std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::this_thread::sleep_for(50ms);
if (!KillIfRunning(full_command))
{
m_error = QString("Unable to kill existing '%1'.")
Expand Down Expand Up @@ -372,7 +372,7 @@ void ExternIO::Fork(void)
{
LOG(VB_GENERAL, LOG_WARNING,
"ExternIO::Fork(): Failed to set O_NONBLOCK for FD: " + ENO);
std::this_thread::sleep_for(std::chrono::seconds(2));
std::this_thread::sleep_for(2s);
_exit(GENERIC_EXIT_PIPE_FAILURE);
}

Expand Down Expand Up @@ -607,13 +607,13 @@ void ExternalStreamHandler::run(void)
if (!IsTSOpen())
{
LOG(VB_RECORD, LOG_WARNING, LOC + "TS not open yet.");
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
continue;
}

if (StreamingCount() == 0)
{
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
continue;
}

Expand Down Expand Up @@ -641,7 +641,7 @@ void ExternalStreamHandler::run(void)
}

if (restart_cnt++)
std::this_thread::sleep_for(std::chrono::seconds(20));
std::this_thread::sleep_for(20s);
if (!RestartStream())
{
LOG(VB_RECORD, LOG_ERR, LOC +
Expand All @@ -664,7 +664,7 @@ void ExternalStreamHandler::run(void)
if (CheckForError())
{
if (restart_cnt++)
std::this_thread::sleep_for(std::chrono::seconds(20));
std::this_thread::sleep_for(20s);
if (!RestartStream())
{
LOG(VB_RECORD, LOG_ERR, LOC + "Failed to restart stream.");
Expand Down Expand Up @@ -725,7 +725,7 @@ void ExternalStreamHandler::run(void)
}
}

std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::this_thread::sleep_for(50ms);

// HLS type streams may only produce data every ~10 seconds
if (nodata_timer.elapsed() < 12000 && buffer.size() < TS_PACKET_SIZE)
Expand Down Expand Up @@ -762,7 +762,7 @@ void ExternalStreamHandler::run(void)
{
if (m_xon && data_short_err++ == 0)
LOG(VB_RECORD, LOG_INFO, LOC + "Waiting for a full TS packet.");
std::this_thread::sleep_for(std::chrono::microseconds(50));
std::this_thread::sleep_for(50us);
continue;
}
if (data_short_err)
Expand Down Expand Up @@ -1040,7 +1040,7 @@ void ExternalStreamHandler::CloseApp(void)
if (!m_io->KillIfRunning(full_command))
{
// Give it one more chance.
std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::this_thread::sleep_for(50ms);
if (!m_io->KillIfRunning(full_command))
{
LOG(VB_GENERAL, LOG_ERR,
Expand All @@ -1065,7 +1065,7 @@ bool ExternalStreamHandler::RestartStream(void)
if (streaming)
StopStreaming();

std::this_thread::sleep_for(std::chrono::seconds(1));
std::this_thread::sleep_for(1s);

if (streaming)
return StartStreaming();
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/dvbchannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ bool DVBChannel::Open(DVBChannel *who)
"fatal error or too many attempts."));
return false;
}
std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::this_thread::sleep_for(50ms);
}

// Get the basic information from the frontend
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmythtv/recorders/dvbstreamhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void DVBStreamHandler::RunTS(void)
m_bError = true;
return;
}
std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::this_thread::sleep_for(50ms);
}

int remainder = 0;
Expand Down Expand Up @@ -241,7 +241,7 @@ void DVBStreamHandler::RunTS(void)

if ((0 == len) || (-1 == len))
{
std::this_thread::sleep_for(std::chrono::microseconds(100));
std::this_thread::sleep_for(100us);
continue;
}
}
Expand Down Expand Up @@ -338,7 +338,7 @@ void DVBStreamHandler::RunSR(void)
}

if (!readSomething)
std::this_thread::sleep_for(std::chrono::milliseconds(3));
std::this_thread::sleep_for(3ms);
}
LOG(VB_RECORD, LOG_DEBUG, LOC + "RunSR(): " + "shutdown");

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/firewiredevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ bool FirewireDevice::SetChannel(const QString &panel_model,
if (!SendAVCCommand(cmd, ret, -1))
return false;

std::this_thread::sleep_for(std::chrono::milliseconds(500));
std::this_thread::sleep_for(500ms);
}

SetLastChannel(channel);
Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmythtv/recorders/firewiresignalmonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void FirewireSignalMonitor::RunTableMonitor(void)
// NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage)
LOG(VB_CHANNEL, LOG_INFO, LOC + "RunTableMonitor(): -- err");
while (m_dtvMonitorRunning)
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);

LOG(VB_CHANNEL, LOG_INFO, LOC + "RunTableMonitor(): -- err end");
return;
Expand All @@ -157,15 +157,15 @@ void FirewireSignalMonitor::RunTableMonitor(void)
dev->AddListener(this);

while (m_dtvMonitorRunning && GetStreamData())
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);

LOG(VB_CHANNEL, LOG_INFO, LOC + "RunTableMonitor(): -- shutdown ");

dev->RemoveListener(this);
dev->ClosePort();

while (m_dtvMonitorRunning)
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);

LOG(VB_CHANNEL, LOG_INFO, LOC + "RunTableMonitor(): -- end");
}
Expand Down Expand Up @@ -291,7 +291,7 @@ void FirewireSignalMonitor::UpdateValues(void)
"Waiting for table monitor to start");

while (!m_dtvMonitorRunning)
std::this_thread::sleep_for(std::chrono::milliseconds(5));
std::this_thread::sleep_for(5ms);

LOG(VB_CHANNEL, LOG_INFO, LOC + "UpdateValues() -- "
"Table monitor started");
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/hdhrrecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void HDHRRecorder::run(void)
{
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Recording will not commence until a PMT is set.");
std::this_thread::sleep_for(std::chrono::milliseconds(5));
std::this_thread::sleep_for(5ms);
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/hdhrstreamhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void HDHRStreamHandler::run(void)

if (!data_buffer)
{
std::this_thread::sleep_for(std::chrono::milliseconds(20));
std::this_thread::sleep_for(20ms);
continue;
}

Expand Down
18 changes: 9 additions & 9 deletions mythtv/libs/libmythtv/recorders/hlsstreamhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void HLSStreamHandler::run(void)
QString url = m_tuning.GetURL(0).toString();
int err_cnt = 0;
int nil_cnt = 0;
int open_sleep = 500;
std::chrono::milliseconds open_sleep = 500ms;

LOG(VB_GENERAL, LOG_INFO, LOC + "run() -- begin");

Expand All @@ -139,12 +139,12 @@ void HLSStreamHandler::run(void)
{
if (m_hls->FatalError())
break;
std::this_thread::sleep_for(std::chrono::milliseconds(open_sleep));
if (open_sleep < 20000)
open_sleep += 500;
std::this_thread::sleep_for(open_sleep);
if (open_sleep < 20s)
open_sleep += 500ms;
continue;
}
open_sleep = 500;
open_sleep = 500ms;
m_hls->Throttle(m_throttle);
m_throttle = false;
}
Expand Down Expand Up @@ -172,7 +172,7 @@ void HLSStreamHandler::run(void)
if (nil_cnt < 4)
++nil_cnt;
// range .25 to 1 second
std::this_thread::sleep_for(std::chrono::milliseconds(nil_cnt *250));
std::this_thread::sleep_for(nil_cnt * 250ms);
continue;
}
nil_cnt = 0;
Expand Down Expand Up @@ -203,17 +203,17 @@ void HLSStreamHandler::run(void)
}

if (m_hls->IsThrottled())
std::this_thread::sleep_for(std::chrono::seconds(1));
std::this_thread::sleep_for(1s);
else if (size < BUFFER_SIZE)
{
LOG(VB_RECORD, LOG_DEBUG, LOC +
QString("Requested %1 bytes, got %2 bytes.")
.arg(BUFFER_SIZE).arg(size));
// hundredth of a second.
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
}
else
std::this_thread::sleep_for(std::chrono::milliseconds(1));
std::this_thread::sleep_for(1ms);
}

m_hls->Throttle(false);
Expand Down
12 changes: 5 additions & 7 deletions mythtv/libs/libmythtv/recorders/httptsstreamhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <chrono> // for milliseconds
#include <thread> // for sleep_for

using namespace std::chrono_literals;

#define LOC QString("HTTPTSSH[%1](%2): ").arg(m_inputId).arg(m_device)

// BUFFER_SIZE is a multiple of TS_SIZE
Expand Down Expand Up @@ -106,7 +104,7 @@ HTTPTSStreamHandler::~HTTPTSStreamHandler(void)
void HTTPTSStreamHandler::run(void)
{
RunProlog();
int open_sleep = 250;
std::chrono::milliseconds open_sleep = 250ms;
LOG(VB_RECORD, LOG_INFO, LOC + "run() -- begin");
SetRunning(true, false, false);

Expand All @@ -116,12 +114,12 @@ void HTTPTSStreamHandler::run(void)
if (!m_reader->DownloadStream(m_tuning.GetURL(0)))
{
LOG(VB_RECORD, LOG_INFO, LOC + "DownloadStream failed to receive bytes from " + m_tuning.GetURL(0).toString());
std::this_thread::sleep_for(std::chrono::milliseconds(open_sleep));
if (open_sleep < 10000)
open_sleep += 250;
std::this_thread::sleep_for(open_sleep);
if (open_sleep < 10s)
open_sleep += 250ms;
continue;
}
open_sleep = 250;
open_sleep = 250ms;
}

delete m_reader;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/importrecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ bool ImportRecorder::Open(void)
// Slow down run open loop when debugging -v record.
// This is just to make the debugging output less spammy.
if (VERBOSE_LEVEL_CHECK(VB_RECORD, LOG_ANY))
std::this_thread::sleep_for(std::chrono::milliseconds(250));
std::this_thread::sleep_for(250ms);

return false;
}
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/iptvrecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void IPTVRecorder::run(void)
{
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Recording will not commence until a PMT is set.");
std::this_thread::sleep_for(std::chrono::milliseconds(5));
std::this_thread::sleep_for(5ms);
continue;
}
}
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/linuxfirewiredevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ void LinuxFirewireDevice::run(void)
m_priv->m_portHandlerWait.wakeAll();
// we need to unlock & sleep to allow wakeAll to wake other threads.
m_lock.unlock();
std::this_thread::sleep_for(std::chrono::microseconds(2500));
std::this_thread::sleep_for(2500us);
m_lock.lock();

m_priv->m_noDataCnt = 0;
Expand Down
10 changes: 5 additions & 5 deletions mythtv/libs/libmythtv/recorders/mpegrecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ void MpegRecorder::run(void)
elapsed = (elapsedTimer.elapsed() / 1000.0) + 1;
while ((bytesRead / elapsed) > dummyBPS)
{
std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::this_thread::sleep_for(50ms);
elapsed = (elapsedTimer.elapsed() / 1000.0) + 1;
}
}
Expand All @@ -999,7 +999,7 @@ void MpegRecorder::run(void)
elapsed = (elapsedTimer.elapsed() / 1000.0) + 1;
while ((GetFramesWritten() / elapsed) > 30)
{
std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::this_thread::sleep_for(50ms);
elapsed = (elapsedTimer.elapsed() / 1000.0) + 1;
}
}
Expand Down Expand Up @@ -1349,7 +1349,7 @@ bool MpegRecorder::StartEncoding(void)
LOG(VB_GENERAL, LOG_ERR, LOC +
"StartEncoding: read failing, re-opening device: " + ENO);
close(m_readfd);
std::this_thread::sleep_for(std::chrono::milliseconds(2));
std::this_thread::sleep_for(2ms);
m_readfd = open(m_videodevice.toLatin1().constData(),
O_RDWR | O_NONBLOCK);
if (m_readfd < 0)
Expand All @@ -1365,7 +1365,7 @@ bool MpegRecorder::StartEncoding(void)
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("StartEncoding: read failed, retry in %1 msec:")
.arg(100 * idx) + ENO);
std::this_thread::sleep_for(std::chrono::microseconds(idx * 100));
std::this_thread::sleep_for(idx * 100us);
}
}
if (idx == 50)
Expand Down Expand Up @@ -1429,7 +1429,7 @@ void MpegRecorder::StopEncoding(void)
if (m_deviceReadBuffer && m_deviceReadBuffer->IsRunning())
{
// allow last bits of data through..
std::this_thread::sleep_for(std::chrono::milliseconds(20));
std::this_thread::sleep_for(20ms);
m_deviceReadBuffer->Stop();
}

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/satiprecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void SatIPRecorder::run(void)
{
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Recording will not commence until a PMT is set.");
std::this_thread::sleep_for(std::chrono::milliseconds(5));
std::this_thread::sleep_for(5ms);
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/satipstreamhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void SatIPStreamHandler::run(void)
}

// Delay to avoid busy wait loop
std::this_thread::sleep_for(std::chrono::milliseconds(20));
std::this_thread::sleep_for(20ms);

}
LOG(VB_RECORD, LOG_INFO, LOC + "RunTS(): " + "shutdown");
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/satiputils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ QStringList SatIP::probeDevices(void)

while (totalTime.elapsed() < milliSeconds)
{
std::this_thread::sleep_for(std::chrono::milliseconds(25));
std::this_thread::sleep_for(25ms);
int ttl = milliSeconds - totalTime.elapsed();
if (searchTime.elapsed() > 249 && ttl > 1000)
{
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/v4l2encrecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void V4L2encRecorder::run(void)
{
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Recording will not commence until a PMT is set.");
std::this_thread::sleep_for(std::chrono::milliseconds(5));
std::this_thread::sleep_for(5ms);
continue;
}

Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmythtv/recorders/v4l2encstreamhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ bool V4L2encStreamHandler::StartEncoding(void)
LOG(VB_GENERAL, LOG_ERR, LOC +
"StartEncoding: read failing, re-opening device: " + ENO);
close(m_fd);
std::this_thread::sleep_for(std::chrono::milliseconds(2));
std::this_thread::sleep_for(2ms);
m_fd = open(m_device.toLatin1().constData(), O_RDWR | O_NONBLOCK);
if (m_fd < 0)
{
Expand All @@ -566,7 +566,7 @@ bool V4L2encStreamHandler::StartEncoding(void)
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("StartEncoding: read failed, retry in %1 msec:")
.arg(100 * idx) + ENO);
std::this_thread::sleep_for(std::chrono::microseconds(idx * 100));
std::this_thread::sleep_for(idx * 100us);
}
}
if (idx == 50)
Expand Down Expand Up @@ -644,7 +644,7 @@ bool V4L2encStreamHandler::StopEncoding(void)

// allow last bits of data through..
if (m_drb && m_drb->IsRunning())
std::this_thread::sleep_for(std::chrono::milliseconds(20));
std::this_thread::sleep_for(20ms);
#if 0
// close the fd so streamoff/streamon work in V4LChannel Close();
close(m_fd);
Expand Down Expand Up @@ -975,7 +975,7 @@ bool V4L2encStreamHandler::SetBitrateForResolution(void)
m_v4l2.Close();
m_v4l2.Open(m_device, m_vbiDevice);
}
std::this_thread::sleep_for(std::chrono::microseconds(100));
std::this_thread::sleep_for(100us);
}
if (idx == 5)
return false;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/vboxutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ QStringList VBox::probeDevices(void)
MythTimer searchTime; searchTime.start();
while (totalTime.elapsed() < milliSeconds)
{
std::this_thread::sleep_for(std::chrono::milliseconds(25));
std::this_thread::sleep_for(25ms);
int ttl = milliSeconds - totalTime.elapsed();
if ((searchTime.elapsed() > 249) && (ttl > 1000))
{
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/tv_play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2366,7 +2366,7 @@ bool TV::StartRecorder(int MaxWait)
SetErrored();
return false;
}
std::this_thread::sleep_for(std::chrono::microseconds(5));
std::this_thread::sleep_for(5us);
}

if (!recording || m_exitPlayerTimerId)
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/tv_rec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4308,7 +4308,7 @@ void TVRec::TuningNewRecorder(MPEGStreamData *streamData)
// Wait for recorder to start.
m_stateChangeLock.unlock();
while (!m_recorder->IsRecording() && !m_recorder->IsErrored())
std::this_thread::sleep_for(std::chrono::microseconds(5));
std::this_thread::sleep_for(5us);
m_stateChangeLock.lock();

if (GetV4LChannel())
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/tvremoteutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ bool RemoteGetRecordingStatus(

state = strlist[0].toInt();
if (kState_ChangingState == state)
std::this_thread::sleep_for(std::chrono::milliseconds(5));
std::this_thread::sleep_for(5ms);
}

if (kState_RecordingOnly == state || kState_WatchingRecording == state)
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythui/devices/lirc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ void LIRC::run(void)
while (IsDoRunSet())
{
if (m_eofCount && m_retryCount)
std::this_thread::sleep_for(std::chrono::milliseconds(100));
std::this_thread::sleep_for(100ms);

if ((m_eofCount >= 10) || (!d->m_lircState))
{
Expand All @@ -430,7 +430,7 @@ void LIRC::run(void)
m_retryCount = 0;
else
// wait a while before we retry..
std::this_thread::sleep_for(std::chrono::seconds(2));
std::this_thread::sleep_for(2s);

continue;
}
Expand Down
4 changes: 0 additions & 4 deletions mythtv/libs/libmythui/mythdisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
#include "mythegl.h"
#include "mythmainwindow.h"

// Std
#include <chrono>
using namespace std::chrono_literals;

#ifdef USING_DBUS
#include "platforms/mythdisplaymutter.h"
#endif
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythui/mythmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
#include <QtAndroid>
#endif

using namespace std::chrono_literals;
static constexpr std::chrono::milliseconds GESTURE_TIMEOUT { 1s };
#define STANDBY_TIMEOUT 90 // Minutes
#define LONGPRESS_INTERVAL 1000
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythui/mythpainterwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "platforms/mythwaylandextras.h"
#endif

using namespace std::chrono_literals;
#define MYTH_PAINTER_QT QString("Qt")

using TryPainter = bool(*)(MythMainWindow*, MythPainterWindow*&, MythPainter*&, bool&);
Expand Down
2 changes: 0 additions & 2 deletions mythtv/libs/libmythui/mythscreenstack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#include <QString>
#include <QTimer>

using namespace std::chrono_literals;

const int kFadeVal = 20;

MythScreenStack::MythScreenStack(MythMainWindow *parent, const QString &name,
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythui/mythscreenstack.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <QObject>

#include "mythuiexp.h"
#include "mythchrono.h"

class QString;

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythui/mythudplistener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ MythUDP::MythUDP()
{
m_listener->moveToThread(m_thread->qthread());
m_thread->start();
do { std::this_thread::sleep_for(std::chrono::microseconds(5)); }
do { std::this_thread::sleep_for(5us); }
while (!m_thread->qthread()->isRunning());
}

Expand Down
2 changes: 0 additions & 2 deletions mythtv/libs/libmythui/mythuibutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include "mythuistatetype.h"
#include "mythuitext.h"

using namespace std::chrono_literals;

MythUIButton::MythUIButton(MythUIType *parent, const QString &name)
: MythUIType(parent, name)
{
Expand Down
2 changes: 0 additions & 2 deletions mythtv/libs/libmythui/mythuifilebrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include "mythuitext.h"
#include "mythuiutils.h"

using namespace std::chrono_literals;

#if QT_VERSION < QT_VERSION_CHECK(5,10,0)
#define qEnvironmentVariable getenv
#endif
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythui/mythuistatetracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void MythUIStateTracker::GetFreshState(QVariantMap &State)

int tries = 0;
while ((tries++ < 100) && (MythUIStateTracker::TimeSinceLastUpdate() >= 500))
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);

MythUIStateTracker::GetState(State);
}
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythui/mythuiwebbrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ int BrowserApi::GetVolume(void)
while (!timer.hasExpired(2000) && !m_gotAnswer)
{
QCoreApplication::processEvents();
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
}

if (m_gotAnswer)
Expand Down Expand Up @@ -228,7 +228,7 @@ QString BrowserApi::GetMetadata(void)
while (!timer.hasExpired(2000) && !m_gotAnswer)
{
QCoreApplication::processEvents();
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
}

if (m_gotAnswer)
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythupnp/bufferedsocketdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ qulonglong BufferedSocketDevice::WaitForMore(
// give up control

// should be some multiple of msWait.
std::this_thread::sleep_for(std::chrono::milliseconds(1));
std::this_thread::sleep_for(1ms);

}
}
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythupnp/ssdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ void SSDP::ProcessData( MSocketDevice *pSocket )
break;
}
retries++;
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
continue;
}
LOG(VB_GENERAL, LOG_ERR, QString("Socket readBlock error %1")
Expand Down
2 changes: 0 additions & 2 deletions mythtv/libs/libmythupnp/websocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#include <QtCore>
#include <QtGlobal>

using namespace std::chrono_literals;

/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythbackend/encoderlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ bool EncoderLink::MatchesRecording(const ProgramInfo *rec)
if (m_local)
{
while (kState_ChangingState == GetState())
std::this_thread::sleep_for(std::chrono::microseconds(100));
std::this_thread::sleep_for(100us);

if (IsBusyRecording())
tvrec = m_tv->GetRecording();
Expand Down
22 changes: 10 additions & 12 deletions mythtv/programs/mythbackend/mainserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@
// mythbackend headers
#include "backendcontext.h"

using namespace std::chrono_literals;

/** Milliseconds to wait for an existing thread from
* process request thread pool.
*/
Expand Down Expand Up @@ -2374,7 +2372,7 @@ void MainServer::DoDeleteThread(DeleteStruct *ds)
{
// sleep a little to let frontends reload the recordings list
// after deleting a recording, then we can hammer the DB and filesystem
std::this_thread::sleep_for(std::chrono::seconds(3));
std::this_thread::sleep_for(3s);
std::this_thread::sleep_for(std::chrono::milliseconds(MythRandom()%2));

m_deletelock.lock();
Expand Down Expand Up @@ -2465,7 +2463,7 @@ void MainServer::DoDeleteThread(DeleteStruct *ds)
else
{
delete_file_immediately(ds->m_filename, followLinks, false);
std::this_thread::sleep_for(std::chrono::seconds(2));
std::this_thread::sleep_for(2s);
if (checkFile.exists())
errmsg = true;
}
Expand Down Expand Up @@ -2612,15 +2610,15 @@ void MainServer::DoDeleteInDB(DeleteStruct *ds)
QString("Error deleting recorded entry for %1.") .arg(logInfo));
}

std::this_thread::sleep_for(std::chrono::seconds(1));
std::this_thread::sleep_for(1s);

// Notify the frontend so it can requery for Free Space
QString msg = QString("RECORDING_LIST_CHANGE DELETE %1")
.arg(ds->m_recordedid);
gCoreContext->SendEvent(MythEvent(msg));

// sleep a little to let frontends reload the recordings list
std::this_thread::sleep_for(std::chrono::seconds(3));
std::this_thread::sleep_for(3s);

query.prepare("DELETE FROM recordedmarkup "
"WHERE chanid = :CHANID AND starttime = :STARTTIME;");
Expand Down Expand Up @@ -2764,17 +2762,17 @@ bool MainServer::TruncateAndClose(ProgramInfo *pginfo, int fd,
}

// Time between truncation steps in milliseconds
const size_t sleep_time = 500;
constexpr std::chrono::milliseconds sleep_time = 500ms;
const size_t min_tps = 8 * 1024 * 1024;
const auto calc_tps = (size_t) (cards * 1.2 * (22200000LL / 8.0));
const size_t tps = std::max(min_tps, calc_tps);
const auto increment = (size_t) (tps * (sleep_time * 0.001F));
const auto increment = (size_t) (tps * (sleep_time.count() * 0.001F));

LOG(VB_FILE, LOG_INFO, LOC +
QString("Truncating '%1' by %2 MB every %3 milliseconds")
.arg(filename)
.arg(increment / (1024.0 * 1024.0), 0, 'f', 2)
.arg(sleep_time));
.arg(sleep_time.count()));

GetMythDB()->GetDBManager()->PurgeIdleConnections(false);

Expand Down Expand Up @@ -2803,7 +2801,7 @@ bool MainServer::TruncateAndClose(ProgramInfo *pginfo, int fd,

count++;

std::this_thread::sleep_for(std::chrono::milliseconds(sleep_time));
std::this_thread::sleep_for(sleep_time);
}

bool ok = (0 == close(fd));
Expand Down Expand Up @@ -2953,7 +2951,7 @@ void MainServer::DoHandleStopRecording(
while (elink->IsBusyRecording() ||
elink->GetState() == kState_ChangingState)
{
std::this_thread::sleep_for(std::chrono::microseconds(100));
std::this_thread::sleep_for(100us);
}

if (m_ismaster)
Expand Down Expand Up @@ -7828,7 +7826,7 @@ void MainServer::connectionClosed(MythSocket *socket)
if (enc->IsLocal())
{
while (enc->GetState() == kState_ChangingState)
std::this_thread::sleep_for(std::chrono::microseconds(500));
std::this_thread::sleep_for(500us);

if (enc->IsBusy() &&
enc->GetChainID() == chain->GetID())
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythbackend/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5086,7 +5086,7 @@ int Scheduler::FillRecordingDir(
{
if (cnt++ % 20 == 0)
LOG(VB_SCHEDULE, LOG_WARNING, "Waiting for main server.");
std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::this_thread::sleep_for(50ms);
}

int fsID = -1;
Expand Down
8 changes: 4 additions & 4 deletions mythtv/programs/mythcommflag/ClassicCommDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ bool ClassicCommDetector::go()
if (m_bStop)
return false;

std::this_thread::sleep_for(std::chrono::seconds(2));
std::this_thread::sleep_for(2s);
secsSince = m_recordingStartedAt.secsTo(MythDate::current());
}

Expand Down Expand Up @@ -337,7 +337,7 @@ bool ClassicCommDetector::go()
if (m_bStop)
return false;

std::this_thread::sleep_for(std::chrono::seconds(2));
std::this_thread::sleep_for(2s);
secsSince = m_recordingStartedAt.secsTo(MythDate::current());
}
}
Expand Down Expand Up @@ -487,12 +487,12 @@ bool ClassicCommDetector::go()
while (m_bPaused)
{
emit breathe();
std::this_thread::sleep_for(std::chrono::seconds(1));
std::this_thread::sleep_for(1s);
}

// sleep a little so we don't use all cpu even if we're niced
if (!m_fullSpeed && !m_stillRecording)
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);

if (((currentFrameNumber % 500) == 0) ||
((m_showProgress || m_stillRecording) &&
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythcommflag/ClassicLogoDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ bool ClassicLogoDetector::searchForLogo(MythCommFlagPlayer *player)
}

if (!m_commDetector->m_fullSpeed)
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);

DetectEdges(vf, edgeCounts, edgediff);

Expand Down
10 changes: 5 additions & 5 deletions mythtv/programs/mythcommflag/CommDetector2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ void waitForBuffer(const struct timeval *framestart, int minlag, int flaglag,
timersub(&now, framestart, &elapsed);

// Sleep for one frame's worth of time.
long sleepus = usperframe - elapsed.tv_sec * 1000000 - elapsed.tv_usec;
if (sleepus <= 0)
auto sleepus = std::chrono::microseconds(usperframe - elapsed.tv_sec * 1000000 - elapsed.tv_usec);
if (sleepus <= 0us)
return;

if (flaglag > minlag)
Expand All @@ -73,7 +73,7 @@ void waitForBuffer(const struct timeval *framestart, int minlag, int flaglag,
// Slow down; increase sleep time
sleepus = sleepus * 3 / 2;
}
std::this_thread::sleep_for(std::chrono::microseconds(sleepus));
std::this_thread::sleep_for(sleepus);
}

bool MythPlayerInited(FrameAnalyzerItem &pass,
Expand Down Expand Up @@ -581,7 +581,7 @@ bool CommDetector2::go(void)
while (m_bPaused)
{
emit breathe();
std::this_thread::sleep_for(std::chrono::seconds(1));
std::this_thread::sleep_for(1s);
}

if (!searchingForLogo(m_logoFinder, *m_currentPass) &&
Expand Down Expand Up @@ -624,7 +624,7 @@ bool CommDetector2::go(void)

// sleep a little so we don't use all cpu even if we're niced
if (!m_fullSpeed && !m_isRecording)
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);

if (m_sendBreakMapUpdates && (m_breakMapUpdateRequested ||
!(m_currentFrameNumber % 500)))
Expand Down
8 changes: 4 additions & 4 deletions mythtv/programs/mythcommflag/PrePostRollFlagger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ bool PrePostRollFlagger::go()
if (m_bStop)
return false;

std::this_thread::sleep_for(std::chrono::seconds(5));
std::this_thread::sleep_for(5s);
secsSince = m_startedAt.secsTo(MythDate::current());
}

Expand Down Expand Up @@ -155,7 +155,7 @@ bool PrePostRollFlagger::go()
return false;
emit statusUpdate(QCoreApplication::translate("(mythcommflag)",
"Waiting for recording to finish"));
std::this_thread::sleep_for(std::chrono::seconds(5));
std::this_thread::sleep_for(5s);
}
m_stillRecording = false;
m_myTotalFrames = m_player->GetTotalFrameCount();
Expand Down Expand Up @@ -279,12 +279,12 @@ long long PrePostRollFlagger::findBreakInrange(long long startFrame,
while (m_bPaused)
{
emit breathe();
std::this_thread::sleep_for(std::chrono::seconds(1));
std::this_thread::sleep_for(1s);
}

// sleep a little so we don't use all cpu even if we're niced
if (!m_fullSpeed && !m_stillRecording)
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);

if (((currentFrameNumber % 500) == 0) ||
((m_showProgress || m_stillRecording) &&
Expand Down
12 changes: 6 additions & 6 deletions mythtv/programs/mythexternrecorder/MythExternControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

#include <iostream>

using namespace std::chrono_literals;

const QString VERSION = "0.6";

#define LOC Desc()
Expand Down Expand Up @@ -77,12 +79,12 @@ Q_SLOT void MythExternControl::Done(void)
m_flowCond.notify_all();
m_runCond.notify_all();

std::this_thread::sleep_for(std::chrono::microseconds(50));
std::this_thread::sleep_for(50us);

while (m_commandsRunning || m_bufferRunning)
{
std::unique_lock<std::mutex> lk(m_flowMutex);
m_flowCond.wait_for(lk, std::chrono::milliseconds(1000));
m_flowCond.wait_for(lk, 1s);
}

LOG(VB_RECORD, LOG_CRIT, LOC + "Terminated.");
Expand Down Expand Up @@ -540,7 +542,7 @@ bool Buffer::Fill(const QByteArray & buffer)
QString("Packet queue overrun. Dropped %1 packets, %2 bytes.")
.arg(++s_dropped).arg(s_droppedBytes));

std::this_thread::sleep_for(std::chrono::microseconds(250));
std::this_thread::sleep_for(250us);
}

m_parent->m_flowMutex.unlock();
Expand Down Expand Up @@ -569,9 +571,7 @@ void Buffer::Run(void)
{
{
std::unique_lock<std::mutex> lk(m_parent->m_flowMutex);
m_parent->m_flowCond.wait_for(lk,
std::chrono::milliseconds
(wait ? 5000 : 25));
m_parent->m_flowCond.wait_for(lk, wait ? 5s : 25ms);
wait = false;
}

Expand Down
6 changes: 3 additions & 3 deletions mythtv/programs/mythexternrecorder/MythExternRecApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Q_SLOT void MythExternRecApp::Close(void)
LOG(VB_RECORD, LOG_INFO, LOC + ": Closing application.");
m_run = false;
m_runCond.notify_all();
std::this_thread::sleep_for(std::chrono::microseconds(50));
std::this_thread::sleep_for(50us);
}

if (m_tuneProc.state() == QProcess::Running)
Expand All @@ -225,7 +225,7 @@ Q_SLOT void MythExternRecApp::Close(void)
{
m_proc.closeReadChannel(QProcess::StandardOutput);
TerminateProcess(m_proc, "App");
std::this_thread::sleep_for(std::chrono::microseconds(50));
std::this_thread::sleep_for(50us);
}

emit Done();
Expand Down Expand Up @@ -713,7 +713,7 @@ Q_SLOT void MythExternRecApp::StartStreaming(const QString & serial)
return;
}

std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::this_thread::sleep_for(50ms);

if (m_proc.state() != QProcess::Running)
{
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythfrontend/audiogeneralsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ void AudioTestThread::run()
}
m_audioOutput->Drain();
m_audioOutput->Pause(true);
std::this_thread::sleep_for(std::chrono::milliseconds(500)); // .5s pause
std::this_thread::sleep_for(500ms); // .5s pause
m_audioOutput->Pause(false);
}
if (m_channel >= 0)
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythfrontend/backendconnectionmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ BackendConnectionManager::BackendConnectionManager()
BackendConnectionManager::~BackendConnectionManager()
{
while (m_reconnecting)
std::this_thread::sleep_for(std::chrono::milliseconds(250));
std::this_thread::sleep_for(250ms);
gCoreContext->removeListener(this);
}

Expand Down
2 changes: 0 additions & 2 deletions mythtv/programs/mythfrontend/galleryinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include "mythcoreutil.h"
#include "mythdate.h"

using namespace std::chrono_literals;


//! The exif/video tags comprising the Basic file info
static QSet<QString> kBasicInfoSet {
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythfrontend/gallerythumbview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static void WaitUntilDone(MThread &worker)
worker.start();
while (!worker.isFinished())
{
std::this_thread::sleep_for(std::chrono::milliseconds(1));
std::this_thread::sleep_for(1ms);
QCoreApplication::processEvents();
}
}
Expand Down
2 changes: 0 additions & 2 deletions mythtv/programs/mythfrontend/idlescreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

#include <tvremoteutil.h>

using namespace std::chrono_literals;

static constexpr std::chrono::milliseconds UPDATE_INTERVAL { 15s };

IdleScreen::IdleScreen(MythScreenStack *parent)
Expand Down
24 changes: 12 additions & 12 deletions mythtv/programs/mythfrontend/networkcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ QString NetworkControl::processJump(NetworkCommand *nc)
timer.start();
while (!timer.hasExpired(FE_SHORT_TO) &&
(GetMythUI()->GetCurrentLocation().toLower() != nc->getArg(1)))
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);

return result;
}
Expand Down Expand Up @@ -492,7 +492,7 @@ QString NetworkControl::processKey(NetworkCommand *nc)

if (nc->getArg(curToken) == "sleep")
{
std::this_thread::sleep_for(std::chrono::seconds(1));
std::this_thread::sleep_for(1s);
}
else if (m_keyMap.contains(nc->getArg(curToken)))
{
Expand Down Expand Up @@ -589,7 +589,7 @@ QString NetworkControl::processPlay(NetworkCommand *nc, int clientID)
timer.start();
while (!timer.hasExpired(FE_LONG_TO) &&
(GetMythUI()->GetCurrentLocation().toLower() != "mainmenu"))
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
}

if (GetMythUI()->GetCurrentLocation().toLower() == "mainmenu")
Expand Down Expand Up @@ -618,7 +618,7 @@ QString NetworkControl::processPlay(NetworkCommand *nc, int clientID)
timer.start();
while (!timer.hasExpired(FE_LONG_TO) &&
(GetMythUI()->GetCurrentLocation().toLower() == "playback"))
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
}

if (GetMythUI()->GetCurrentLocation().toLower() != "playbackbox")
Expand All @@ -629,11 +629,11 @@ QString NetworkControl::processPlay(NetworkCommand *nc, int clientID)
timer.start();
while (!timer.hasExpired(10000) &&
(GetMythUI()->GetCurrentLocation().toLower() != "playbackbox"))
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);

timer.start();
while (!timer.hasExpired(10000) && (!MythMainWindow::IsTopScreenInitialized()))
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
}

if (GetMythUI()->GetCurrentLocation().toLower() == "playbackbox")
Expand All @@ -655,7 +655,7 @@ QString NetworkControl::processPlay(NetworkCommand *nc, int clientID)
gCoreContext->dispatch(me);

while (!timer.hasExpired(FE_LONG_TO) && !m_gotAnswer)
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);

if (m_gotAnswer)
result += m_answer;
Expand Down Expand Up @@ -703,7 +703,7 @@ QString NetworkControl::processPlay(NetworkCommand *nc, int clientID)
while (!timer.hasExpired(FE_SHORT_TO) && !m_gotAnswer)
{
qApp->processEvents();
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
}

if (m_gotAnswer)
Expand All @@ -723,7 +723,7 @@ QString NetworkControl::processPlay(NetworkCommand *nc, int clientID)
while (!timer.hasExpired(FE_SHORT_TO) && !m_gotAnswer)
{
qApp->processEvents();
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
}

if (m_gotAnswer)
Expand All @@ -743,7 +743,7 @@ QString NetworkControl::processPlay(NetworkCommand *nc, int clientID)
while (!timer.hasExpired(FE_SHORT_TO) && !m_gotAnswer)
{
qApp->processEvents();
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
}

if (m_gotAnswer)
Expand Down Expand Up @@ -943,7 +943,7 @@ QString NetworkControl::processQuery(NetworkCommand *nc)
QElapsedTimer timer;
timer.start();
while (!timer.hasExpired(FE_SHORT_TO) && !m_gotAnswer)
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);

if (m_gotAnswer)
result += m_answer;
Expand Down Expand Up @@ -1033,7 +1033,7 @@ QString NetworkControl::processQuery(NetworkCommand *nc)
QElapsedTimer timer;
timer.start();
while (!timer.hasExpired(FE_SHORT_TO) && !m_gotAnswer)
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);

if (m_gotAnswer)
str = m_answer;
Expand Down
6 changes: 3 additions & 3 deletions mythtv/programs/mythfrontend/services/frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ bool Frontend::PlayRecording(int RecordedId, int ChanId,
timer.start();
while (!timer.hasExpired(10000) &&
(GetMythUI()->GetCurrentLocation().toLower() == "playback"))
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
}

if (GetMythUI()->GetCurrentLocation().toLower() != "playbackbox")
Expand All @@ -164,11 +164,11 @@ bool Frontend::PlayRecording(int RecordedId, int ChanId,
timer.start();
while (!timer.hasExpired(10000) &&
(GetMythUI()->GetCurrentLocation().toLower() != "playbackbox"))
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);

timer.start();
while (!timer.hasExpired(10000) && (!MythMainWindow::IsTopScreenInitialized()))
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(10ms);
}

if (GetMythUI()->GetCurrentLocation().toLower() == "playbackbox")
Expand Down
2 changes: 0 additions & 2 deletions mythtv/programs/mythfrontend/themechooser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
#include "mythuistatetype.h"
#include "mythuitext.h"

using namespace std::chrono_literals;

#define LOC QString("ThemeChooser: ")
#define LOC_WARN QString("ThemeChooser, Warning: ")
#define LOC_ERR QString("ThemeChooser, Error: ")
Expand Down
6 changes: 2 additions & 4 deletions mythtv/programs/mythfrontend/upnpscanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#include <thread> // for sleep_for
#include <utility>

using namespace std::chrono_literals;

#define LOC QString("UPnPScan: ")
#define ERR QString("UPnPScan error: ")

Expand Down Expand Up @@ -252,7 +250,7 @@ void UPNPScanner::GetMetadata(VideoMetadataListManager::metadata_list* list,

int count = 0;
while (!m_scanComplete && (count++ < 300))
std::this_thread::sleep_for(std::chrono::milliseconds(100));
std::this_thread::sleep_for(100ms);

// some scans may just take too long (PlayOn)
if (!m_scanComplete)
Expand Down Expand Up @@ -310,7 +308,7 @@ bool UPNPScanner::GetMetadata(QVariant &data)
LOG(VB_GENERAL, LOG_INFO, "START");
while (!found && (count++ < 100)) // 10 seconds
{
std::this_thread::sleep_for(std::chrono::milliseconds(100));
std::this_thread::sleep_for(100ms);
m_lock.lock();
if (m_servers.contains(usn))
{
Expand Down
2 changes: 0 additions & 2 deletions mythtv/programs/mythfrontend/videodlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
// for ImageDLFailureEvent
#include "metadataimagedownload.h"

using namespace std::chrono_literals;

#define LOC_MML QString("Manual Metadata Lookup: ")

static const QString sLocation = "MythVideo";
Expand Down
4 changes: 1 addition & 3 deletions mythtv/programs/mythlcdserver/lcdprocclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
#define LCD_VERSION_4 1
#define LCD_VERSION_5 2

using namespace std::chrono_literals;

static constexpr std::chrono::milliseconds LCD_TIME_TIME { 3s };
static constexpr std::chrono::milliseconds LCD_SCROLLLIST_TIME { 2s };

Expand Down Expand Up @@ -157,7 +155,7 @@ bool LCDProcClient::connectToHost(const QString &lhostname, unsigned int lport)
while (--timeout && m_socket->state() != QAbstractSocket::ConnectedState)
{
qApp->processEvents();
std::this_thread::sleep_for(std::chrono::milliseconds(1));
std::this_thread::sleep_for(1ms);

if (m_socket->state() == QAbstractSocket::ConnectedState)
{
Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythtranscode/videodecodebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ VideoDecodeBuffer::~VideoDecodeBuffer()
m_runThread = false;
m_frameWaitCond.wakeAll();
while (m_isRunning)
std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::this_thread::sleep_for(50ms);
}

void VideoDecodeBuffer::stop()
{
m_runThread = false;
m_frameWaitCond.wakeAll();
while (m_isRunning)
std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::this_thread::sleep_for(50ms);
}

void VideoDecodeBuffer::run()
Expand Down
2 changes: 0 additions & 2 deletions mythtv/programs/mythwelcome/welcomedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#include "welcomedialog.h"
#include "welcomesettings.h"

using namespace std::chrono_literals;

static constexpr std::chrono::milliseconds UPDATE_STATUS_INTERVAL { 30s };
static constexpr std::chrono::milliseconds UPDATE_SCREEN_INTERVAL { 15s };

Expand Down