std::unique_ptr<QgsMeshCalculator> QgsMeshCalculatorDialog::calculator() const { std::unique_ptr<QgsMeshCalculator> calc; if ( useExtentCb->isChecked() ) { calc.reset( new QgsMeshCalculator( formulaString(), outputFile(), outputExtent(), startTime(), endTime(), meshLayer() ) ); } else { calc.reset( new QgsMeshCalculator( formulaString(), outputFile(), maskGeometry(), startTime(), endTime(), meshLayer() ) ); } return calc; }
void timelineWidget::wheelEvent( QWheelEvent *event ) { timeInView( timeInView() - ( (float)event->delta() / 32.0 ) ); if( timeInView() > ( endTime() - beginTime() ) ) { timeInView( endTime() - beginTime() ); } update(); }
void PixmapCacheModel::flattenLoads() { int collapsedRowCount = 0; // computes "compressed row" QVector <qint64> eventEndTimes; for (int i = 0; i < count(); i++) { PixmapCacheModel::PixmapCacheItem &event = m_data[i]; if (event.pixmapEventType == PixmapCacheModel::PixmapLoadingStarted) { event.rowNumberCollapsed = 0; while (eventEndTimes.count() > event.rowNumberCollapsed && eventEndTimes[event.rowNumberCollapsed] > startTime(i)) event.rowNumberCollapsed++; if (eventEndTimes.count() == event.rowNumberCollapsed) eventEndTimes << 0; // increase stack length, proper value added below eventEndTimes[event.rowNumberCollapsed] = endTime(i); // readjust to account for category empty row and bargraph event.rowNumberCollapsed += 2; } if (event.rowNumberCollapsed > collapsedRowCount) collapsedRowCount = event.rowNumberCollapsed; } // Starting from 0, count is maxIndex+1 setCollapsedRowCount(collapsedRowCount + 1); setExpandedRowCount(m_pixmaps.count() + 2); }
bool GraphWidget::loadScript(const char* szFileName) { std::ifstream ifsFile; ifsFile.open(szFileName, std::ios::in); if (!ifsFile.fail()) { int iCurveCount; float fEndTime; ifsFile >> fEndTime; if (fEndTime <= 0.0f) return false; endTime(fEndTime); ifsFile >> iCurveCount; if (iCurveCount != m_pcrvvCurves.size()) { #ifdef _DEBUG assert(0); #endif // _DEBUG return false; } for (int i = 0; i < iCurveCount; ++i) { int iType; ifsFile >> iType; curveType(i, iType); m_pcrvvCurves[i]->fromStream(ifsFile); } return true; }
void ContinuousServiceUpdateAction::_setFromParametersMap(const ParametersMap& map) { try { _service = ContinuousServiceTableSync::GetEditable(map.get<RegistryKeyType>(PARAMETER_SERVICE_ID), *_env); } catch(ObjectNotFoundException<ContinuousService>&) { throw ActionException("No such service"); } _duration = minutes(map.get<int>(PARAMETER_WAITING_DURATION)); time_duration endTime(not_a_date_time); if(!map.getDefault<string>(PARAMETER_END_TIME).empty()) { try { endTime = duration_from_string(map.get<string>(PARAMETER_END_TIME)); } catch(bad_lexical_cast) { throw ActionException("Bad end time"); } } time_duration startTime(_service->getDepartureSchedule(false, 0)); _range = endTime - startTime; }
bool VTTCue::isEqual(const VTTCue& cue, CueMatchRules match) const { if (cueType() != cue.cueType()) return false; if (match != IgnoreDuration && endTime() != cue.endTime()) return false; if (startTime() != cue.startTime()) return false; if (text() != cue.text()) return false; if (cueSettings() != cue.cueSettings()) return false; if (id() != cue.id()) return false; if (position() != cue.position()) return false; if (line() != cue.line()) return false; if (size() != cue.size()) return false; if (align() != cue.align()) return false; return true; }
static void test_fma() { for(int i=0; i<1020 * 4; i++) { data_f[i] = i; } float32x4_t c0_02 = vdupq_n_f32(0.02f); float32x4_t c0_04 = vdupq_n_f32(0.04f); float32x4_t c0_05 = vdupq_n_f32(0.05f); float32x4_t c0_10 = vdupq_n_f32(0.1f); float32x4_t c0_20 = vdupq_n_f32(0.2f); float32x4_t c1_00 = vdupq_n_f32(1.0f); startTime(); // Do ~1 billion ops for (int ct=0; ct < (1000 * (1000 / 80)); ct++) { for (int i=0; i < 1000; i++) { float32x4_t t; t = vmulq_f32(vld1q_f32((float32_t *)&data_f[i]), c0_02); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+4]), c0_04); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+8]), c0_05); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+12]), c0_10); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+16]), c0_20); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+20]), c0_20); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+24]), c0_10); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+28]), c0_05); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+32]), c0_04); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+36]), c0_02); t = vaddq_f32(t, c1_00); vst1q_f32((float32_t *)&data_f[i], t); } } endTime("neon fma", 1e9); }
static void test_mad() { for(int i=0; i<1020; i++) { data_f[i] = i; } startTime(); // Do ~1 billion ops for (int ct=0; ct < (1000 * (1000 / 20)); ct++) { for (int i=0; i < 1000; i++) { data_f[i] = (data_f[i] * 0.02f + data_f[i+1] * 0.04f + data_f[i+2] * 0.05f + data_f[i+3] * 0.1f + data_f[i+4] * 0.2f + data_f[i+5] * 0.2f + data_f[i+6] * 0.1f + data_f[i+7] * 0.05f + data_f[i+8] * 0.04f + data_f[i+9] * 0.02f + 1.f); } } endTime("scalar mad", 1e9); }
void QmlProfilerRangeModel::findBindingLoops() { typedef QPair<int, int> CallStackEntry; QStack<CallStackEntry> callStack; for (int i = 0; i < count(); ++i) { int potentialParent = callStack.isEmpty() ? -1 : callStack.top().second; while (potentialParent != -1 && !(endTime(potentialParent) > startTime(i))) { callStack.pop(); potentialParent = callStack.isEmpty() ? -1 : callStack.top().second; } // check whether event is already in stack for (int ii = 0; ii < callStack.size(); ++ii) { if (callStack.at(ii).first == typeId(i)) { m_data[i].bindingLoopHead = callStack.at(ii).second; break; } } CallStackEntry newEntry(typeId(i), i); callStack.push(newEntry); } }
void DummyStorageLink::waitForMessage(const api::MessageType& type, int timeout) { framework::defaultimplementation::RealClock clock; framework::MilliSecTime endTime( clock.getTimeInMillis() + framework::MilliSecTime(timeout * 1000)); vespalib::MonitorGuard lock(_waitMonitor); while (true) { for (uint32_t i=0; i<_commands.size(); ++i) { if (_commands[i]->getType() == type) return; } for (uint32_t i=0; i<_replies.size(); ++i) { if (_replies[i]->getType() == type) return; } if (timeout != 0 && clock.getTimeInMillis() > endTime) { std::ostringstream ost; ost << "Timed out waiting for " << type << " message to " << "arrive in dummy storage link. Only " << (_commands.size() + _replies.size()) << " messages seen " << "after timout of " << timeout << " seconds was reached."; if (_commands.size() == 1) { ost << " Found command of type " << _commands[0]->getType(); } if (_replies.size() == 1) { ost << " Found command of type " << _replies[0]->getType(); } throw vespalib::IllegalStateException(ost.str(), VESPA_STRLOC); } if (timeout >= 0) { lock.wait((endTime - clock.getTimeInMillis()).getTime()); } else { lock.wait(); } } }
void ScaleAffector::animate(long long dt, long long age) { W_UNUSED(dt); float d = delta(age, startTime(), endTime()); Vector ds = priv->end - priv->start; Vector scale = priv->start + (ds*d); sprite->scale(scale); }
void HeartMonodomainData::showMe( std::ostream& output ) { output << "\n*** Values for data [fluid/time_discretization]\n\n"; output << "endtime = " << endTime() << std::endl; output << "\n*** Values for data [fluid/miscellaneous]\n\n"; output << "verbose = " << M_verbose << std::endl; }
// --------------------------------------------------------------------------- // duration // --------------------------------------------------------------------------- //! Return time, in seconds, spanned by this Partial, or 0. if there //! are no Breakpoints. // double Partial::duration( void ) const { if ( numBreakpoints() == 0 ) { return 0.; } return endTime() - startTime(); }
void Timer::limitFPS(int fps) { int t = (1.0 / (float)fps) * 1000000; if(t < getTick()) return; //sf::sleep((t - getTick()) / 1000); //SDL_Delay((t - getTick()) / 1000); endTime(); }
int Fact::isTrue(Fact* fact, Time time) { if((fact->getType() == getType()) && ((time > (starttime())) || (time == starttime())) && (time < endTime())) { return 1; } else { return 0; } }
int EventEditor::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 11) qt_static_metacall(this, _c, _id, _a); _id -= 11; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = subject(); break; case 1: *reinterpret_cast< QString*>(_v) = location(); break; case 2: *reinterpret_cast< QDateTime*>(_v) = startTime(); break; case 3: *reinterpret_cast< QDateTime*>(_v) = endTime(); break; case 4: *reinterpret_cast< int*>(_v) = folderId(); break; case 5: *reinterpret_cast< int*>(_v) = accountId(); break; case 6: *reinterpret_cast< Mode*>(_v) = mode(); break; } _id -= 7; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setSubject(*reinterpret_cast< QString*>(_v)); break; case 1: setLocation(*reinterpret_cast< QString*>(_v)); break; case 2: setStartTime(*reinterpret_cast< QDateTime*>(_v)); break; case 3: setEndTime(*reinterpret_cast< QDateTime*>(_v)); break; case 4: setFolderId(*reinterpret_cast< int*>(_v)); break; case 5: setAccountId(*reinterpret_cast< int*>(_v)); break; case 6: setMode(*reinterpret_cast< Mode*>(_v)); break; } _id -= 7; } else if (_c == QMetaObject::ResetProperty) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 7; } #endif // QT_NO_PROPERTIES return _id; }
bool TextTrackCueGeneric::isOrderedBefore(const TextTrackCue* that) const { if (that->cueType() == Generic && startTime() == that->startTime() && endTime() == that->endTime()) { // Further order generic cues by their calculated line value. std::pair<double, double> thisPosition = getPositionCoordinates(); std::pair<double, double> thatPosition = toVTTCue(that)->getPositionCoordinates(); return thisPosition.second > thatPosition.second || (thisPosition.second == thatPosition.second && thisPosition.first < thatPosition.first); } if (that->cueType() == Generic) return startTime() > that->startTime(); return VTTCue::isOrderedBefore(that); }
/** @brief 检查硬件时钟是否工作正常 */ void StatManager::checkClock() { endTime(); int dure_time = dure_time_end-dure_time_start; int saveTime; if(dure_time>=3600) { char buf[100]; dure_time_start=dure_time_end; if(QFile::exists("/Data/setup/lastTime")) { QFile file("/Data/setup/lastTime"); file.open(QIODevice::ReadOnly); QByteArray ba = file.readAll(); QString str(ba); saveTime = str.toInt(); if(dure_time_start>saveTime) { sprintf(buf,"/bin/echo %d > /Data/setup/lastTime",(int)dure_time_start); system(buf); } } else { sprintf(buf,"/bin/echo %d > /Data/setup/lastTime",(int)dure_time_start); system(buf); } } int deltaClkTime = clkTime_end-clkTime_start; int deltaSysTime = sysTime_end-sysTime_start; if(deltaSysTime>1000) { deltaClkTime = clkTime_end-clkTime_start; if(abs(deltaClkTime-deltaSysTime)>240) { // qDebug()<<"----------------start sys time = " <<sysTime_start; // qDebug()<<"----------------start clock time = "<<clkTime_start; // qDebug()<<"----------------end sys time = " <<sysTime_end; // qDebug()<<"----------------end clock time = "<<clkTime_end; // qDebug()<<"----------------delta sys time = " <<deltaSysTime; // qDebug()<<"----------------delta clock time = "<<deltaClkTime; // messageBox::reportInfor(Infor_HWClockFailed); } } }
FileProcessor::parse(vector<Lecture> list) { string input, token = ""; int field = 1; if (!fin.good()) return; else { //fields of a lecture string courseCode; Time startTime, endTime; //parsing file, line by line while (!fin.eof()) { //pull first line getline(fin,input); //pulling values from the line for (int i = input.begin(); i < input.end(); i++) { //found complete field if (input.at(i)==' ' || input.at(i)=='\n') { if (field==1) courseCode=token; else if (field==2) startTime(token); else endTime(token); field++; } //else not done yet else { token+=input.at(i); } } //end of line, create lecture, add to list Lecture lec(courseCode, &startTime, &endTime); list.push_back(&lec); } produceSchedule(list); } }
int64_t CSimpleFileCache::WaitForData(unsigned int iMinAvail, unsigned int iMillis) { if( iMillis == 0 || IsEndOfInput() ) return GetAvailableRead(); XbmcThreads::EndTime endTime(iMillis); while (!IsEndOfInput()) { int64_t iAvail = GetAvailableRead(); if (iAvail >= iMinAvail) return iAvail; if (!m_hDataAvailEvent->WaitMSec(endTime.MillisLeft())) return CACHE_RC_TIMEOUT; } return GetAvailableRead(); }
ros::Duration Timing::peekDiff() { if(!_ended) { ros::Time endTime(0,0); if(_useUserTimes) { struct timespec ts; clock_gettime(CLOCK_REALTIME, &ts); endTime = ros::Time(ts.tv_sec,ts.tv_nsec); } else { ros::WallTime wt = ros::WallTime::now(); endTime = ros::Time(wt.sec,wt.nsec); } return (endTime - _startTime); } else { return (_endTime - _startTime); } }
bool Monitor::waitForAbort(double timeout) { XBMC_TRACE; int timeoutMS = ceil(timeout * 1000); XbmcThreads::EndTime endTime(timeoutMS > 0 ? timeoutMS : XbmcThreads::EndTime::InfiniteValue); while (!endTime.IsTimePast()) { { DelayedCallGuard dg(languageHook); unsigned int t = std::min(endTime.MillisLeft(), 100u); if (abortEvent.WaitMSec(t)) return true; } if (languageHook) languageHook->MakePendingCalls(); } return false; }
QString RouteInfo::toString() { if(m_trackpts.size() < 2) return QString(); QString retval; retval += QObject::tr("Aloitus: "); retval += startTime().toString("dd.MM hh:mm"); retval += "\n"; retval += QObject::tr("Lopetus: "); retval += endTime().toString("dd.MM hh:mm"); retval += "\n"; retval += QObject::tr("Reitin pituus: "); retval += QString::number(trackDistance(), 'f', 2); retval += QObject::tr(" km"); return retval; }
PaintTileOperation::~PaintTileOperation() { #ifdef PROFILE_TEXTURES_GENERATOR_MULTI_CORE if (m_profileWholeTxGenTime) endTime(); #endif if (m_tile) { m_tile->setRepaintPending(false); m_tile = 0; } /// M: call releasePainter to release m_painter releasePainter(m_painter); #ifdef DEBUG_COUNT ClassTracker::instance()->decrement("PaintTileOperation"); #endif }
void GameScene::onTimer(float dt) { currentTime += dt; int remainTime = (int)(GameManager::MAX_TIME-currentTime); if(this->remainTime == remainTime) return; else this->remainTime = remainTime; char* text = "%d/%d"; char* buffer = new char[10]; sprintf(buffer, text,remainTime,GameManager::MAX_TIME); lb_timer->setText(buffer); int percent = ( remainTime * 1.0f / GameManager::MAX_TIME) * 100; //CCLog("currentTIme:%f,percent:%d",currentTime,percent); timer_progress->setPercent(percent); if(remainTime < 30 && remainTime >= 29) { // SendMessageWithParams(string("timeLeft"), NULL); } if(remainTime <= 0) endTime(); }
void sleep(long timemillis) { XBMC_TRACE; XbmcThreads::EndTime endTime(timemillis); while (!endTime.IsTimePast()) { LanguageHook* lh = NULL; { DelayedCallGuard dcguard; lh = dcguard.getLanguageHook(); // borrow this long nextSleep = endTime.MillisLeft(); if (nextSleep > 100) nextSleep = 100; // only sleep for 100 millis ::Sleep(nextSleep); } if (lh != NULL) lh->MakePendingCalls(); } }
bool GraphWidget::loadModelScript(const char* szFileName) { std::ifstream ifsFile; ifsFile.open(szFileName, std::ios::in); if (ifsFile.fail()) return false; int iModelCurveCount; // number of curves in model that is currently loaded int iFileCurveCount; // number of curves in model as reported by the ani file float fEndTime; // As of 01sp, curves for the camera show up in the left "model controls" pane. // The ani file format doesn't save the camera curves, so we don't want to count // them when we're calculating the total number of curves in the model. iModelCurveCount = m_pcrvvCurves.size() - NUM_CAM_CURVES; ifsFile >> fEndTime; if (fEndTime <= 0.0f) return false; endTime(fEndTime); ifsFile >> iFileCurveCount; if (iFileCurveCount != iModelCurveCount) { #ifdef _DEBUG assert(0); #endif // _DEBUG return false; } for (int i = 0; i < iModelCurveCount; ++i) { int iType; ifsFile >> iType; curveType(i, iType); m_pcrvvCurves[i]->fromStream(ifsFile); } return true; }
void DummyStorageLink::waitForMessages(unsigned int msgCount, int timeout) { framework::defaultimplementation::RealClock clock; framework::MilliSecTime endTime( clock.getTimeInMillis() + framework::MilliSecTime(timeout * 1000)); vespalib::MonitorGuard lock(_waitMonitor); while (_commands.size() + _replies.size() < msgCount) { if (timeout != 0 && clock.getTimeInMillis() > endTime) { std::ostringstream ost; ost << "Timed out waiting for " << msgCount << " messages to " << "arrive in dummy storage link. Only " << (_commands.size() + _replies.size()) << " messages seen " << "after timout of " << timeout << " seconds was reached."; throw vespalib::IllegalStateException(ost.str(), VESPA_STRLOC); } if (timeout >= 0) { lock.wait((endTime - clock.getTimeInMillis()).getTime()); } else { lock.wait(); } } }
int EventViewer::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 5) qt_static_metacall(this, _c, _id, _a); _id -= 5; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = subject(); break; case 1: *reinterpret_cast< QString*>(_v) = location(); break; case 2: *reinterpret_cast< QString*>(_v) = startTime(); break; case 3: *reinterpret_cast< QString*>(_v) = endTime(); break; } _id -= 4; } else if (_c == QMetaObject::WriteProperty) { _id -= 4; } else if (_c == QMetaObject::ResetProperty) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 4; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 4; } #endif // QT_NO_PROPERTIES return _id; }
int64_t CSimpleFileCache::WaitForData(unsigned int iMinAvail, unsigned int iMillis) { if( iMillis == 0 || IsEndOfInput() ) return GetAvailableRead(); XbmcThreads::EndTime endTime(iMillis); unsigned int millisLeft; while ( !IsEndOfInput() && (millisLeft = endTime.MillisLeft()) > 0 ) { int64_t iAvail = GetAvailableRead(); if (iAvail >= iMinAvail) return iAvail; // busy look (sleep max 1 sec each round) if (!m_hDataAvailEvent->WaitMSec(millisLeft>1000?millisLeft:1000 )) return CACHE_RC_ERROR; } if( IsEndOfInput() ) return GetAvailableRead(); return CACHE_RC_TIMEOUT; }