C++ (Qt)public: QElapsedTimer timer;
C++ (Qt)qlonglong res = timer.elapsed();qlonglong s = res/1000; QString ss = QString::number(s);qlonglong m = s/60; QString mm = QString::number(m);qlonglong h = m/60; QString hh = QString::number(h);QString timeelapsed = hh + ":" + mm + ":" + ss; qDebug() << res << "ms";qDebug() << "Времени прошло: " << timeelapsed;
C++ (Qt)int res = timer.elapsed(); // elapsed вернет intint sec = res / 1000; int min = sec / 60; sec %= 60;int hr = min / 60; min %= 60;char buf[128];sprintf(buf, "%2d : %2d : %2d", hr, min, sec);qDebug() << "Времени прошло: " << buf;
C++ (Qt) qint64 res = timer.elapsed(); qint64 sec = res / 1000; qint64 min = sec / 60; qint64 hr = min / 60; sec %= 60; min %= 60; QString timeElapsed = QString("%1:%2:%3").arg(hr).arg(min).arg(sec); //QString timeElapsed; QTextStream(&timeElapsed) << hr << ":" << min << ":" << sec; qDebug() << res << "ms"; qDebug() << "Времени прошло: " << timeElapsed;