本文整理汇总了C++中RelativeTime类的典型用法代码示例。如果您正苦于以下问题:C++ RelativeTime类的具体用法?C++ RelativeTime怎么用?C++ RelativeTime使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RelativeTime类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: heartbeat
void heartbeat()
{
if (mNeedToEnd)
{
Time now = Time::getCurrentTime();
RelativeTime dt = (now - mLastXYTime);
if (dt.inMilliseconds() > 200)
{
mEditor->getMover()->end(kOsc);
mNeedToEnd = false;
}
}
if (!mAddress) return;
int src = mEditor->getOscLeapSource();
if (src != mSource)
{
String s = "Source "; s << (src+1);
lo_send(mAddress, kSelectSourcePath, "s", s.toRawUTF8());
mSource = src;
}
FPoint p = mFilter->getSourceXY01(src);
if (mSourceXY != p)
{
//fprintf(stderr, "sent new pos to %s\n", kSourceXYPath);
lo_send(mAddress, kSourceXYPath, "ff", p.y, p.x);
mSourceXY = p;
}
}
示例2: name
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;
}
示例3: audioFileName
// =================================================================================================================
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;
}
示例4: getBounds
void CallOutBox::inputAttemptWhenModal()
{
if (dismissalMouseClicksAreAlwaysConsumed
|| targetArea.contains (getMouseXYRelative() + getBounds().getPosition()))
{
// if you click on the area that originally popped-up the callout, you expect it
// to get rid of the box, but deleting the box here allows the click to pass through and
// probably re-trigger it, so we need to dismiss the box asynchronously to consume the click..
// For touchscreens, we make sure not to dismiss the CallOutBox immediately,
// as Windows still sends touch events before the CallOutBox had a chance
// to really open.
RelativeTime elapsed = Time::getCurrentTime() - creationTime;
if (elapsed.inMilliseconds() > 200)
dismiss();
}
else
{
exitModalState (0);
setVisible (false);
}
}
示例5:
bool operator<= (RelativeTime t1, RelativeTime t2) noexcept
{
return t1.inSeconds() <= t2.inSeconds();
}
示例6:
bool operator<= (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() <= t2.inSeconds(); }
示例7: md5
//.........这里部分代码省略.........
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;
}