//--------------------------------------------------- void AllegroTimer::updateStopWatch() { if(elapsedTimer) updateElapsedTime(); else updateCountdown(); }
void MpdClientDialog::onElapsedSecondsAtStatusChange(int elapsedSeconds) { qDebug() << "elapsedSeconds:" << elapsedSeconds; elapsedSeconds_ = elapsedSeconds; timedSeconds_ = 0; updateElapsedTime(); }
/** * Initializes the LibDS system and instructs the class to close the LibDS * before the Qt application is closed. */ void DriverStation::start() { if (!DS_Initialized()) { DS_Init(); processEvents(); updateElapsedTime(); emit statusChanged (generalStatus()); connect (qApp, SIGNAL (aboutToQuit()), this, SLOT (quitDS())); } }
void NBodyWindow::updateBuffer() { updateElapsedTime(); size_t nVertices = _bufSize / 4; for( size_t i = 0; i < nVertices; ++i ) { float xFraction = float( i + 2 * _elapsedTime ) / float( nVertices - 1 ); float yFraction = float( i - 2 * _elapsedTime ) / float( nVertices - 1 ); _buf[4*i] = cosf( 2 * 3.1415f * xFraction ); _buf[4*i+1] = sinf( 2 * 3.1415f * yFraction ); _buf[4*i+2] = 0.0f; // ignore z-coordinate _buf[4*i+3] = 1.0f; // ignore extra } glBindBuffer( GL_ARRAY_BUFFER, _positionBufferObject ); glBufferSubData( GL_ARRAY_BUFFER, 0, sizeof( float ) * _bufSize, _buf ); glBindBuffer( GL_ARRAY_BUFFER, 0 ); }
/** * Updates the elapsed time and formats it as a string only if the robot * is currently enabled */ void DriverStation::updateElapsedTime() { if (isEnabled()) { int milliseconds = m_time.elapsed(); int seconds = (milliseconds / 1000); int minutes = (seconds / 60) % 60; seconds = seconds % 60; milliseconds = milliseconds % 1000; m_elapsedTime = QString ("%1:%2.%3") .arg (minutes, 2, 10, QLatin1Char ('0')) .arg (seconds, 2, 10, QLatin1Char ('0')) .arg (QString::number (milliseconds).at (0)); emit elapsedTimeChanged (elapsedTime()); } QTimer::singleShot (100, Qt::PreciseTimer, this, SLOT (updateElapsedTime())); }
void MpdClientDialog::onTimeout() { timedSeconds_ += 2; updateElapsedTime(); }