本文整理汇总了C++中CDateTime::AddMinutes方法的典型用法代码示例。如果您正苦于以下问题:C++ CDateTime::AddMinutes方法的具体用法?C++ CDateTime::AddMinutes怎么用?C++ CDateTime::AddMinutes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDateTime
的用法示例。
在下文中一共展示了CDateTime::AddMinutes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runTest
// RunTest
void CDriver::runTest(int iSleep, int iTestDuration)
{
g_tid = (pthread_t*) malloc(sizeof(pthread_t) * iUsers);
// before starting the test run Trade-Cleanup transaction
cout << endl <<
"Running Trade-Cleanup transaction before starting the test..." <<
endl;
m_pCDM->DoCleanupTxn();
cout << "Trade-Cleanup transaction completed." << endl << endl;
// time to sleep between thread creation, convert from millaseconds to
// nanoseconds.
struct timespec ts, rem;
ts.tv_sec = (time_t) (iSleep / 1000);
ts.tv_nsec = (long) (iSleep % 1000) * 1000000;
// Caulculate when the test should stop.
int threads_start_time =
(int) ((double) iSleep / 1000.0 * (double) iUsers);
stop_time = time(NULL) + iTestDuration + threads_start_time;
CDateTime dtAux;
dtAux.SetToCurrent();
cout << "Test is starting at " << dtAux.ToStr(02) << endl <<
"Estimated duration of ramp-up: " << threads_start_time <<
" seconds" << endl;
dtAux.AddMinutes((iTestDuration + threads_start_time)/60);
cout << "Estimated end time " << dtAux.ToStr(02) << endl;
logErrorMessage(">> Start of ramp-up.\n");
// start thread that runs the Data Maintenance transaction
entryDMWorkerThread(this);
// parameter for the new thread
PCustomerThreadParam pThrParam;
for (int i = 1; i <= iUsers; i++) {
pThrParam = new TCustomerThreadParam;
// zero the structure
memset(pThrParam, 0, sizeof(TCustomerThreadParam));
pThrParam->pDriver = this;
entryCustomerWorkerThread(reinterpret_cast<void *>(pThrParam), i);
// Sleep for between starting terminals
while (nanosleep(&ts, &rem) == -1) {
if (errno == EINTR) {
memcpy(&ts, &rem, sizeof(timespec));
} else {
ostringstream osErr;
osErr << "sleep time invalid " << ts.tv_sec << " s " <<
ts.tv_nsec << " ns" << endl;
logErrorMessage(osErr.str());
break;
}
}
}
// mark end of ramp-up
m_MixLock.lock();
m_fMix << (int) time(NULL) << ",START,,," <<
(long long) pthread_self() << endl;
m_MixLock.unlock();
logErrorMessage(">> End of ramp-up.\n\n");
// wait until all threads quit
// 0 represents the Data-Maintenance thread
for (int i = 0; i <= iUsers; i++) {
if (pthread_join(g_tid[i], NULL) != 0) {
throw new CThreadErr( CThreadErr::ERR_THREAD_JOIN,
"Driver::RunTest" );
}
}
}