qint64 TTiming::getNextTrigger(QDateTime actual) { qint64 ret = 0; QDateTime calculate = wall_clock.datetime; if (actual > wall_clock.datetime) { // if wallclock date is in past and repeats -1 (indefinite) get time for the next event/trigger/shot from period if (wall_clock.repeats == -1) { // find out the next possible trigger based on the datetime of the wallclock do { calculate = addWallClockIntervalOptimized(actual, calculate); // do some shortcuts cause addWallClockInterval is extremly slow on long times } while (actual > calculate); ret = actual.msecsTo(calculate); } // if wallclock date is in past and repeats > 0 calculate elapsed time since init and look if there is be another event possible else if (wall_clock.repeats > 0) ret = analyseRemainingRepeats(actual); // repeat 0 return 0 ms } else // datetime of wallclock is in future ret = actual.msecsTo(wall_clock.datetime); return ret; }
void WalletStatusBar::updateStatusDescription() { if (!m_walletIsSynchronized) { return; } quint32 localBlockCount = m_nodeStateModel->index(0, NodeStateModel::COLUMN_LOCAL_BLOCK_COUNT).data(NodeStateModel::ROLE_LOCAL_BLOCK_COUNT).value<quint32>(); QDateTime lastLocalBlockTimestamp = QDateTime::fromTime_t(m_nodeStateModel->index(0, NodeStateModel::COLUMN_LAST_LOCAL_BLOCK_TIMESTAMP).data(NodeStateModel::ROLE_LAST_LOCAL_BLOCK_TIMESTAMP).value<quint64>()).toUTC(); quintptr peerCount = m_nodeStateModel->index(0, NodeStateModel::COLUMN_PEER_COUNT).data(NodeStateModel::ROLE_PEER_COUNT).value<quintptr>(); QDateTime currentDateTime = QDateTime::currentDateTimeUtc(); quint64 timeDiff = lastLocalBlockTimestamp.msecsTo(currentDateTime); QString warningString; if (timeDiff > MSECS_IN_HOUR) { warningString.append(QString(" Warning: last block was received %1 hours %2 minutes ago."). arg(timeDiff / MSECS_IN_HOUR).arg((timeDiff % MSECS_IN_HOUR) / MSECS_IN_MINUTE)); } if (peerCount == 0) { warningString.append(tr(" No network connection.")); } QString statusText = tr("Wallet synchronized. Top block height: %1 / Time (UTC): %2%3"); m_syncStatusLabel->setText(statusText.arg(localBlockCount - 1). arg(QLocale(QLocale::English).toString(lastLocalBlockTimestamp, "dd MMM yyyy, HH:mm:ss")). arg(warningString)); }
void Logger::writeLog(quint32 AType, const QString &AClass, const QString &AMessage) { QMutexLocker locker(&FMutex); LoggerData *q = instance()->d; if ((q->enabledTypes & AType)>0 && q->logFile.isOpen()) { static QDateTime lastLogTime = QDateTime::currentDateTime(); QDateTime curDateTime = QDateTime::currentDateTime(); QString typeName; switch(AType) { case Logger::Fatal: typeName = "!FTL"; break; case Logger::Error: typeName = "!ERR"; break; case Logger::Warning: typeName = "*WNG"; break; case Logger::Info: typeName = " INF"; break; case Logger::View: typeName = " VIW"; break; case Logger::Event: typeName = " EVT"; break; case Logger::Timing: typeName = " TMG"; break; case Logger::Debug: typeName = " DBG"; break; case Logger::Stanza: typeName = " STZ"; break; default: typeName = QString(" T%1").arg(AType); } QString timestamp = curDateTime.toString("hh:mm:ss.zzz"); int timeDelta = lastLogTime.msecsTo(curDateTime); QString logLine = QString("%1\t+%2\t%3\t[%4] %5").arg(timestamp).arg(timeDelta).arg(typeName,AClass,AMessage); q->logFile.write(logLine.toUtf8()); q->logFile.write("\r\n"); q->logFile.flush(); #if defined(DEBUG_MODE) if (AType <= Logger::Warning) qDebug() << logLine; #endif q->loggedTypes |= AType; lastLogTime = curDateTime; } }
void RuleWatch::refreshWatch(const QDateTime &now) { qDebug("RuleWatch::refreshWatch(%s)", qPrintable(now.toString())); _timer.stop(); QDateTime nextNearestDateTime; qDebug("RuleWatch::refreshWatch size of rules: %d", _rules->size()); for (Rules::const_iterator i = _rules->constBegin(); i != _rules->constEnd(); ++i) { const RuleItem &item = *i; if (item.ruleActive) { QDateTime nearestFromRule = _nextDateTimeFromRule(now, item); if (!nearestFromRule.isNull() && (nextNearestDateTime.isNull() || nearestFromRule < nextNearestDateTime)) { qDebug("Setting nearest to %s, was %s", qPrintable(nearestFromRule.toString()), qPrintable(nextNearestDateTime.toString())); nextNearestDateTime = nearestFromRule; _targetRuleItem = &item; } } } if (!nextNearestDateTime.isNull()) { quint64 interval = now.msecsTo(nextNearestDateTime); qDebug("Now %s", qPrintable(now.toString())); qDebug("Scheduling a timer to %s, interval %dms", qPrintable(nextNearestDateTime.toString()), (int)interval); _timer.start(interval); } else { _targetRuleItem = NULL; qDebug("No nearest time based rule found"); } }
qint64 timeUntilTomorrow() { QDateTime now = QDateTime::currentDateTime(); QDateTime tomorrow = now.addDays(1); // Tomorrow. tomorrow.setTime(QTime()); // Midnight. return now.msecsTo(tomorrow); }
void MainWindow::timerEvent(QTimerEvent *) { if(mRunning) { mSessionTime = mStartTime.msecsTo(QDateTime::currentDateTime()); qint64 time = mTotalTime + mSessionTime; time *= 111; ui->mLabel->setText(CalculateTimeStr(time)); } }
void FileTransferWindow::updateFile(qlonglong position, qlonglong total) { static QDateTime lastUpdate = QDateTime::currentDateTime(); if (lastUpdate.msecsTo(QDateTime::currentDateTime()) < 200) return; lastUpdate = QDateTime::currentDateTime(); double progress = (100.0 * position) / double(total); ui.progressBar->setValue(static_cast<int>(progress)); }
bool TestOperation::iterate() { QDateTime start = QDateTime::currentDateTime(); QDateTime stepStart = QDateTime::currentDateTime(); if (!this->computeVectors()) { return false; } qDebug() << "Compute time (s):" << stepStart.secsTo(QDateTime::currentDateTime()); stepStart = QDateTime::currentDateTime(); if (!this->applyVectors()) { return false; } qDebug() << "Apply time (s):" << stepStart.secsTo(QDateTime::currentDateTime()); stepStart = QDateTime::currentDateTime(); if (!this->savePixmap()) { return false; } qDebug() << "Pixmap time (ms):" << stepStart.msecsTo(QDateTime::currentDateTime()); stepStart = QDateTime::currentDateTime(); if (!this->advanceSeeds()) { return false; } qDebug() << "Advance time (ms):" << stepStart.msecsTo(QDateTime::currentDateTime()); qDebug() << "Frame time (s):" << start.secsTo(QDateTime::currentDateTime()); return true; }
void PropagateUploadFileQNAM::start() { if (_propagator->_abortRequested.fetchAndAddRelaxed(0)) return; _file = new QFile(_propagator->getFilePath(_item._file), this); if (!_file->open(QIODevice::ReadOnly)) { done(SyncFileItem::NormalError, _file->errorString()); delete _file; return; } // Update the mtime and size, it might have changed since discovery. _item._modtime = FileSystem::getModTime(_file->fileName()); quint64 fileSize = _file->size(); _item._size = fileSize; // But skip the file if the mtime is too close to 'now'! // That usually indicates a file that is still being changed // or not yet fully copied to the destination. QDateTime modtime = Utility::qDateTimeFromTime_t(_item._modtime); if (modtime.msecsTo(QDateTime::currentDateTime()) < minFileAgeForUpload) { _propagator->_anotherSyncNeeded = true; done(SyncFileItem::SoftError, tr("Local file changed during sync.")); delete _file; return; } _chunkCount = std::ceil(fileSize/double(chunkSize())); _startChunk = 0; _transferId = qrand() ^ _item._modtime ^ (_item._size << 16); const SyncJournalDb::UploadInfo progressInfo = _propagator->_journal->getUploadInfo(_item._file); if (progressInfo._valid && Utility::qDateTimeToTime_t(progressInfo._modtime) == _item._modtime ) { _startChunk = progressInfo._chunk; _transferId = progressInfo._transferid; qDebug() << Q_FUNC_INFO << _item._file << ": Resuming from chunk " << _startChunk; } _currentChunk = 0; _duration.start(); emit progress(_item, 0); this->startNextChunk(); }
qint64 Logger::finishTiming(const QString &AVariable, const QString &AContext) { qint64 timing = -1; QMutexLocker locker(&FMutex); LoggerData *q = instance()->d; QMap<QString, QDateTime> &varMap = q->timings[AVariable]; QDateTime startTime = varMap.take(AContext); if (startTime.isValid()) timing = startTime.msecsTo(QDateTime::currentDateTime()); if (varMap.isEmpty()) q->timings.remove(AVariable); return timing; }
void Sensor::readData() { SensorReading reading; while (m_serialPort.canReadLine()) { QByteArray line = m_serialPort.readLine().trimmed(); if (!reading.fromCsv(line)) { emit error(reading.lastError()); break; } m_readings.append(reading); QDateTime firstTime = m_readings.first().time(); if (firstTime.msecsTo(QDateTime::currentDateTimeUtc()) >= 5000) { // We have 5 seconds of readings, so emit the batch. emit analyze(m_readings); m_readings.clear(); } } }
qint64 TTiming::analyseRemainingRepeats(QDateTime actual) { QDateTime calculate = wall_clock.datetime; qint64 ret = 0; int i = 0; remaining_repeats = 0; do { calculate = addWallClockInterval(calculate); i++; } while (actual > calculate && i < wall_clock.repeats+1); if (actual < calculate) { ret = actual.msecsTo(calculate); remaining_repeats = wall_clock.repeats - i; } return ret; }
void MarbleClockPrivate::timerTimeout() { // calculate real period elapsed since last call QDateTime curenttime( QDateTime::currentDateTimeUtc() ); int msecdelta = m_lasttime.msecsTo( curenttime ); m_lasttime = curenttime; // update m_datetime at m_speed pace m_datetime = m_datetime.addMSecs( msecdelta * m_speed ); // trigger round minute update (at m_speed pace) emit q->timeChanged(); // sleeptime is the time to sleep until next round minute, at m_speed pace int sleeptime = ( m_updateInterval * 1000 - (qreal)(m_datetime.time().msec() + m_datetime.time().second() * 1000 ) ) / m_speed; if ( sleeptime < 1000 ) { // don't trigger more often than 1s sleeptime = 1000; } m_timer.start( sleeptime ); //mDebug() << "MarbleClock: will sleep for " << sleeptime; }
// 每次收盘/断网/崩溃/退出等等,都会清空ringbufer,需要重来一下下面的逻辑= // 1.总成交量为0的:无效= // 2.确定第一个有效tick:交易日期+时间,和当前时间偏离在3分钟之外:无效= // 3.确定后续tick是否有效:和上一个tick相比,总成交量不变的:无效= bool isValidTick(RingBuffer* rb, CThostFtdcDepthMarketDataField* curTick) { if (curTick->Volume == 0) { return false; } auto preTick = (CThostFtdcDepthMarketDataField*)rb->get(rb->head()); if (!preTick) { // ActionDay 指当时的日期 // TradingDay 是指当时的交易日期,夜盘算下一个交易的= QDateTime curDateTime = QDateTime::currentDateTime(); QString tickDateTimeStr = QString().sprintf("%s %s.%03d", curTick->ActionDay, curTick->UpdateTime, curTick->UpdateMillisec); QDateTime tickDateTime = QDateTime::fromString(tickDateTimeStr, "yyyyMMdd hh:mm:ss.zzz"); qint64 delta = qAbs(curDateTime.msecsTo(tickDateTime)); if (delta >= 3 * 60 * 1000) { return false; } } else { if (preTick->Volume == curTick->Volume) { return false; } } return true; }
/* Qt 4.6 does not have the msecsTo function - so we roll our own. Return the number of milliseconds from this datetime to the other datetime. If the other datetime is earlier than this datetime, the value returned is negative. Based on msecsTo out of qt-everywhere-opensource-src-4.8.4/src/corelib/tools/qdatetime.cpp */ static qint64 msecsTo_48 (const QDateTime& self, const QDateTime& other) { #if (QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)) return self.msecsTo( other ); #else // More or less a direct copy of 4.8 code. // enum { MSECS_PER_DAY = 86400000 }; QDate selfDate; QDate otherDate; QTime selfTime; QTime otherTime; selfDate = self.toUTC().date(); selfTime = self.toUTC().time(); otherDate = other.toUTC().date(); otherTime = other.toUTC().time(); return (static_cast<qint64>(selfDate.daysTo(otherDate)) * static_cast<qint64>(MSECS_PER_DAY)) + static_cast<qint64>(selfTime.msecsTo(otherTime)); #endif }
SER_Timestamp SER_Header::timestamp(const QDateTime& datetime) { static const QDateTime reference{{1, 1, 1}, {0,0,0}}; return reference.msecsTo(datetime) * 10000; }
void VariableIntervalFrameMapping::onLast() { if (frameCount < inputs.size()) { *err << "Count of video frames (" << frameCount << ") is less than input images " "(" << inputs.size() << "). Some images will be skipped!" << endl; } QDateTime startTimestamp; QDateTime stopTimestamp; QDateTime lastTimestamp; bool first = true; QList<InputImageInfo> inputList; for (InputImageInfo inf : inputs) { //Magick::Image image(input.file.filePath().toStdString()); if (!first && lastTimestamp > inf.timestamp) { *err << "Images are not sorted by its time! Skip " << inf.file.fileName() << endl; } else { inputList.append(inf); if (first || inf.timestamp < startTimestamp) startTimestamp = inf.timestamp; if (first || inf.timestamp > stopTimestamp) stopTimestamp = inf.timestamp; lastTimestamp = inf.timestamp; } first = false; } inputs = inputList; qint64 realTimeLapsDurationMs = startTimestamp.msecsTo(stopTimestamp); if (realTimeLapsDurationMs <= 0) { emit error("All images has equal timestamp!"); return; } *verboseOutput << "Real time-laps duration: " << realTimeLapsDurationMs << " ms" << endl; *verboseOutput << "Sum of frames: " << frameCount << endl; //inputList = QList<InputImageInfo>(); int emited = 0; int lastFrame = -1; int maxStep = 0; for (InputImageInfo inf : inputs) { inf.frame = ( ((double) startTimestamp.msecsTo(inf.timestamp)) / ((double) realTimeLapsDurationMs) * ((double) frameCount)); if (inf.frame >= frameCount) // last frame inf.frame = frameCount - 1; int step = (lastFrame < 0 ? 0 : inf.frame - lastFrame); *verboseOutput << inf.file.fileName() << " " << inf.timestamp.toString(Qt::ISODate) << " > frame " << inf.frame << " (step " << step << ")" << endl; if (step > maxStep) maxStep = step; if (lastFrame >= inf.frame) { *err << "Skip image " << inf.file.fileName() << ", it is too early after previous." << endl << "You can try to increase output length or fps." << endl; } else { //inputList.append(input); emit input(inf); emited++; lastFrame = inf.frame; } } inputs = inputList; *verboseOutput << "Maximum step is " << maxStep << " frames." << endl; if (emited <= 0) { emit error( "No images after frame mapping!"); return; } emit last(); }
qint64 Logger::checkTiming( const QString &AVariable, const QString &AContext) { QMutexLocker locker(&FMutex); QDateTime startTime = instance()->d->timings.value(AVariable).value(AContext); return startTime.isValid() ? startTime.msecsTo(QDateTime::currentDateTime()) : -1; }
void MainWindow::on_enviarButton_clicked() { QFile *caixa; QFile *destino; QFileInfo *caix; QFileInfo *dest; QDateTime *c; QDateTime *d; int i,j,k,l,m; switch(loja){ case 2: caixa = new QFile("C:\\Shop\\internet\\freparet.l02"); destino = new QFile("C:\\Documents and Settings\\Minas Casa\\Meus documentos\\Google Drive\\PM\\freparet.l02"); i = 0; while(destino->exists()){ caix = new QFileInfo(destino->fileName()); dest = new QFileInfo(caixa->fileName()); c = new QDateTime(caix->lastModified()); d = new QDateTime(dest->lastModified()); if(c->msecsTo(*d) == 0){ QMessageBox msgBox8; msgBox8.setText("Caixa já copiado."); msgBox8.exec(); return; } QString directory = QString("C:\\Documents and Settings\\Minas Casa\\Meus documentos\\Google Drive\\PM\\freparet%1.l02").arg(i); destino = new QFile(directory); i++; } break; case 3: caixa = new QFile("C:\\shop\\internet\\freparet.l03"); destino = new QFile("C:\\Users\\Vangogh\\Google Drive\\FT\\freparet.l03"); j = 0; while(destino->exists()){ caix = new QFileInfo(destino->fileName()); dest = new QFileInfo(caixa->fileName()); c = new QDateTime(caix->lastModified()); d = new QDateTime(dest->lastModified()); if(c->msecsTo(*d) == 0){ QMessageBox msgBox8; msgBox8.setText("Caixa já copiado."); msgBox8.exec(); return; } QString directory = QString("C:\\Users\\Vangogh\\Google Drive\\FT\\freparet%1.l03").arg(j); destino = new QFile(directory); j++; } break; case 4: caixa = new QFile("C:\\shop\\internet\\freparet.l04"); destino = new QFile("C:\\Users\\Loja Minas casa\\Google Drive\\MC\\freparet.l04"); k = 0; while(destino->exists()){ caix = new QFileInfo(destino->fileName()); dest = new QFileInfo(caixa->fileName()); c = new QDateTime(caix->lastModified()); d = new QDateTime(dest->lastModified()); if(c->msecsTo(*d) == 0){ QMessageBox msgBox8; msgBox8.setText("Caixa já copiado."); msgBox8.exec(); return; } QString directory = QString("C:\\Users\\Loja Minas casa\\Google Drive\\MC\\freparet%1.l04").arg(k); destino = new QFile(directory); k++; } break; case 6: caixa = new QFile("D:\\Sistema\\SHOP\\INTERNET\\freparet.l06"); destino = new QFile("C:\\Documents and Settings\\Vangogh\\Meus documentos\\Google Drive\\PL\\freparet.l06"); l = 0; while(destino->exists()){ caix = new QFileInfo(destino->fileName()); dest = new QFileInfo(caixa->fileName()); c = new QDateTime(caix->lastModified()); d = new QDateTime(dest->lastModified()); if(c->msecsTo(*d) == 0){ QMessageBox msgBox8; msgBox8.setText("Caixa já copiado."); msgBox8.exec(); return; } QString directory = QString("C:\\Documents and Settings\\Vangogh\\Meus documentos\\Google Drive\\PL\\freparet%1.l06").arg(l); destino = new QFile(directory); l++; } break; case 10: caixa = new QFile("C:\\shop\\internet\\freparet.l10"); destino = new QFile("C:\\Users\\loja Pmapulha\\Google Drive\\Pampulha\\freparet.l10"); m = 0; while(destino->exists()){ caix = new QFileInfo(destino->fileName()); dest = new QFileInfo(caixa->fileName()); c = new QDateTime(caix->lastModified()); d = new QDateTime(dest->lastModified()); if(c->msecsTo(*d) == 0){ QMessageBox msgBox8; msgBox8.setText("Caixa já copiado."); msgBox8.exec(); return; } QString directory = QString("C:\\Users\\loja Pmapulha\\Google Drive\\Pampulha\\freparet%1.l10").arg(m); destino = new QFile(directory); m++; } break; default: caixa = NULL; destino = NULL; break; } if(!caixa->exists()){ QMessageBox msgBox; msgBox.setText("Caixa não existe."); msgBox.exec(); return; } else { if(!caixa->copy(caixa->fileName(), destino->fileName())){ QMessageBox msgBox2; msgBox2.setText("Erro ao copiar"); msgBox2.exec(); } else { QMessageBox msgBox3; msgBox3.setText("Copiado"); msgBox3.exec(); } } }
QgsInterval operator-( const QDateTime &dt1, const QDateTime &dt2 ) { qint64 mSeconds = dt2.msecsTo( dt1 ); return QgsInterval( mSeconds / 1000.0 ); }
bool ZipDirSortItemComparator::operator()(const ZipDirSortItem &n1, const ZipDirSortItem &n2) const { const ZipDirSortItem* f1 = &n1; const ZipDirSortItem* f2 = &n2; qint64 r = 0; if ( options.testFlag( AbZip::SortByTime ) ) { QDateTime firstModified = f1->item.lastModifiedDate; QDateTime secondModified = f2->item.lastModifiedDate; // QDateTime by default will do all sorts of conversions on these to // find timezones, which is incredibly expensive. As we aren't // presenting these to the user, we don't care (at all) about the // local timezone, so force them to UTC to avoid that conversion. firstModified.setTimeSpec(Qt::UTC); secondModified.setTimeSpec(Qt::UTC); r = firstModified.msecsTo(secondModified); } else if ( options.testFlag( AbZip::SortByCompressedSize ) ) { r = f2->item.compressedSize - f1->item.compressedSize; } else if ( options.testFlag( AbZip::SortByUncompressedSize ) ) { r = f2->item.uncompressedSize - f1->item.uncompressedSize; } else if ( options.testFlag( AbZip::SortByType ) ) { if ( options.testFlag( AbZip::CaseSensitive ) ) { f1->suffix = ZipUtils::getFileSuffix( f1->item.filePath ); f2->suffix = ZipUtils::getFileSuffix( f2->item.filePath ); } else { f1->suffix = ZipUtils::getFileSuffix( f1->item.filePath ).toLower(); f2->suffix = ZipUtils::getFileSuffix( f2->item.filePath ).toLower(); } r = f1->suffix.compare(f2->suffix); } else { if ( options.testFlag( AbZip::CaseSensitive ) ) { f1->filename = ZipUtils::getFileName( f1->item.filePath ); f2->filename = ZipUtils::getFileName( f2->item.filePath ); } else { f1->filename = ZipUtils::getFileName( f1->item.filePath ).toLower(); f2->filename = ZipUtils::getFileName( f2->item.filePath ).toLower(); } r = f1->filename.compare(f2->filename); } if ( options.testFlag( AbZip::SortReversed) ) return r > 0; return r < 0; }
// TODO: truncate log when it's over currentMaxLogSize void Log::writeMessage(uint AType, const QString &AMessage) { if (!FLogPath.isEmpty() && (FLogTypes & AType)>0) { static QDateTime lastMessageTime = QDateTime::currentDateTime(); QMutexLocker lock(&FMutex); if (FLogFile.isNull()) { #ifndef DEBUG_ENABLED // Устанавливаем перехватчик Qt-шных сообщений только для релиза, чтобы видеть во время отладки qInstallMsgHandler(qtMessagesHandler); #endif // creating name with current date and time: log_YYYY-MM-DDTHH-MM-SS+TZ.txt FLogFile = QString("log_%1").arg(DateTime(QDateTime::currentDateTime()).toX85DateTime().replace(":","-")); } QDateTime curDateTime = QDateTime::currentDateTime(); QString timestamp = curDateTime.toString("hh:mm:ss.zzz"); int timedelta = lastMessageTime.msecsTo(curDateTime); lastMessageTime = curDateTime; // simple log if (FLogFormat == Simple || FLogFormat == Both) { QFile logFile(FLogPath + "/" + FLogFile + ".txt"); logFile.open(QFile::WriteOnly | QFile::Append); logFile.write(QString("%1\t+%2\t[%3]\t%4\r\n").arg(timestamp).arg(timedelta).arg(AType).arg(AMessage).toUtf8()); logFile.close(); } // html log if (FLogFormat == HTML || FLogFormat == Both) { QFile logFile_html(FLogPath + "/" + FLogFile + ".html"); bool html_existed = QFile::exists(logFile_html.fileName()); logFile_html.open(QFile::WriteOnly | QFile::Append); // writing header if needed if (!html_existed) { logFile_html.write(QString("<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"><title>Rambler Contacts log</title></head>\r\n<body>\r\n").toUtf8()); } // if we got '[' at the beginning, we gonna highlight it in html output (till ']') QString htmlLog; QString marker; if (AType == Error) marker = "red"; else if (AType == Warning) marker = "orange"; else marker = "black"; marker = QString("<font color=%1>●</font>").arg(marker); if (AMessage[0] == '[') { int i = AMessage.indexOf(']'); if (i != -1) { QString highlighted = AMessage.left(i + 1); htmlLog = QString("<p><pre><b>[%1]</b>: %2 %3%4</pre></p>\r\n").arg(timestamp, marker, QString("<font color=orange>%1</font>").arg(highlighted), Qt::escape(AMessage.right(AMessage.length() - i - 1))); } } else htmlLog = QString("<p><pre><b>[%1]</b>: %2 %3</pre></p>\r\n").arg(timestamp, marker, Qt::escape(AMessage)); logFile_html.write(htmlLog.toUtf8()); logFile_html.close(); } } }
double difference(const QDateInterval & r) const { return end.msecsTo(r.start) / 1000.0; }