本文整理汇总了C++中RelativeTime::inSeconds方法的典型用法代码示例。如果您正苦于以下问题:C++ RelativeTime::inSeconds方法的具体用法?C++ RelativeTime::inSeconds怎么用?C++ RelativeTime::inSeconds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RelativeTime
的用法示例。
在下文中一共展示了RelativeTime::inSeconds方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addLoadSample
void LoadMonitor::addLoadSample (LoadEvent const& sample)
{
std::string const& name (sample.name());
RelativeTime const latency (sample.getSecondsTotal());
if (latency.inSeconds() > 0.5)
{
WriteLog ((latency.inSeconds() > 1.0) ? lsWARNING : lsINFO, LoadMonitor)
<< "Job: " << name << " ExecutionTime: " << printElapsed (sample.getSecondsRunning()) <<
" WaitingTime: " << printElapsed (sample.getSecondsWaiting());
}
// VFALCO NOTE Why does 1 become 0?
std::size_t latencyMilliseconds (latency.inMilliseconds());
if (latencyMilliseconds == 1)
latencyMilliseconds = 0;
ScopedLockType sl (mLock, __FILE__, __LINE__);
update ();
++mCounts;
++mLatencyEvents;
mLatencyMSAvg += latencyMilliseconds;
mLatencyMSPeak += latencyMilliseconds;
// VFALCO NOTE Why are we multiplying by 4?
int const latencyPeak = mLatencyEvents * latencyMilliseconds * 4;
if (mLatencyMSPeak < latencyPeak)
mLatencyMSPeak = latencyPeak;
}
示例2: reserveDiskSpace
// =================================================================================================================
bool DiskSampleRecorder::reserveDiskSpace(String outDir, int64 lengthInBytes)
{
String audioFileName(outDir);
File* tempDataFile;
Time now;
if ( !audioFileName.endsWith(File::separatorString))
audioFileName += File::separatorString;
for (int i=0; i < processorOutputs; i++)
{
now = Time::getCurrentTime();
tempDataFile = new File(audioFileName + "channel" + String::formatted("%.2d", i) + ".dat");
if (*tempDataFile == File::nonexistent)
{
mchaRecordPlayer->logError( L"Failed to reserve disk space for data file:\t" + tempDataFile->getFullPathName() );
delete tempDataFile;
return false;
}
else
{
FileOutputStream* tempStream = tempDataFile->createOutputStream();
if (tempStream == NULL)
{
mchaRecordPlayer->logError( L"Failed to create output stream for data file:\t" + tempDataFile->getFullPathName() );
delete tempStream;
delete tempDataFile;
return false;
}
else
{
if (!tempStream->setPosition(lengthInBytes))
{
mchaRecordPlayer->logError( L"Failed to position output stream for data file:\t" + tempDataFile->getFullPathName() + ". Insufficient disk space?" );
delete tempStream;
delete tempDataFile;
return false;
}
else
{
int zeroByte = 0;
tempStream->write( (void *) &zeroByte, 1);
tempStream->flush();
}
}
RelativeTime timeDelay = Time::getCurrentTime() - now;
mchaRecordPlayer->dbgOut( "\tReserving disk space for\t" + tempDataFile->getFullPathName() + "\t" + String(lengthInBytes) + " bytes\t" + String(timeDelay.inSeconds())+ " s elapsed." );
delete tempStream;
delete tempDataFile;
}
}
return true;
}
示例3:
bool operator<= (RelativeTime t1, RelativeTime t2) noexcept
{
return t1.inSeconds() <= t2.inSeconds();
}
示例4:
bool operator<= (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() <= t2.inSeconds(); }
示例5: uploadFile
//.........这里部分代码省略.........
while (1)
{
char buffer;
int read = soc.read(&buffer, 1, true);
if (read == -1)
break;
response += buffer;
if (response.endsWith(("\r\n\r\n")) || response.endsWith(("\n\n")))
{
String len = response.fromFirstOccurrenceOf(("Content-Length: "), false, true);
if (len.isNotEmpty())
{
// normal mode
String num;
int i = 0;
while (CharacterFunctions::isDigit(len[i]))
num += len[i++];
int bytes = num.getIntValue();
char* buffer = new char[bytes + 1];
soc.read(buffer, bytes, true);
buffer[bytes] = 0;
response += buffer;
delete[] buffer;
}
else
{
// chunked
while (1)
{
String line;
char ch;
while (!line.endsWith("\r\n"))
{
soc.read(&ch, 1, true);
line += ch;
}
int sz = line.getHexValue32();
if (sz == 0)
break;
char* buf = new char[sz + 1];
soc.read(buf, sz, true);
buf[sz] = 0;
response += buf;
delete buf;
soc.read(&ch, 1, true);
soc.read(&ch, 1, true);
}
}
#ifdef JUCE_DEBUG
Logger::outputDebugString(response);
#endif
soc.close();
String xml = response.fromFirstOccurrenceOf(("<?xml"), true, true);
XmlDocument doc(xml);
XmlElement* e = doc.getDocumentElement();
if (e)
{
XmlElement* image = e->getChildByName(("Image"));
if (image)
{
int val = image->getIntAttribute(("id"));
if (val >= 0)
{
uf.status = UploadFile::Finished;
uf.complete = 1.0f;
uf.url = image->getStringAttribute("URL");
Time end = Time::getCurrentTime();
RelativeTime diff = end - start;
addLogEntry(("Info: ") + uf.file.getFileName() + (" uploaded in ") + String(int(diff.inSeconds())) + (" seconds [") + String(uf.file.getSize() / 1024 / diff.inSeconds(), 1) + ("KB/s]"));
retval.id = val;
retval.key = image->getStringAttribute(("Key"));
delete e;
return retval;
}
}
delete e;
}
}
}
}
uf.status = UploadFile::Failed;
return retval;
}