Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. time

    Log in to post
    • All categories
    • haykarmeni

      Solved Timer for currently recording audio file
      Brainstorm • timer time recording • • haykarmeni

      17
      0
      Votes
      17
      Posts
      621
      Views

      haykarmeni

      thank you, @eyllanesc, now it works as I expect...thank you very much for so much assistance and readiness :)

    • L

      Solved How do I append characters of a QString to another QString in a neat way?
      General and Desktop • time qstring appending • • legitnameyo

      5
      0
      Votes
      5
      Posts
      438
      Views

      Kent-Dorfman

      @JKSH said in How do I append characters of a QString to another QString in a neat way?:

      Anyway, you could simplify the whole thing:
      QDateTime now = QDateTime::currentDateTime();

      QString yyyy = now.toString("yyyy");
      QString MM = now.toString("MM");
      QString dd = now.toString("dd");
      QString HH = now.toString("HH");
      QString mm = now.toString("mm");
      QString ss = now.toString("ss");

      This is ideally the best general solution, IMHO

    • D

      Solved How to measure time taken for QML item to appear on the screen since it was loaded?
      QML and Qt Quick • qml loader qtquick2 time item • • diredko

      5
      0
      Votes
      5
      Posts
      959
      Views

      S

      If you need this for just measuring the performance of your application, maybe you should use the QML Profiler instead http://doc.qt.io/qtcreator/creator-qml-performance-monitor.html

    • tansgumus

      Unsolved Wrong DESTDIR folder!
      Installation and Deployment • qmake system timestamp time cmd • • tansgumus

      1
      0
      Votes
      1
      Posts
      634
      Views

      No one has replied

    • Ramkumar Rammohan

      Unsolved How to set a time picker in qml list a spanning list ?
      Mobile and Embedded • time picker time date picker qml • • Ramkumar Rammohan

      3
      0
      Votes
      3
      Posts
      1620
      Views

      Ramkumar Rammohan

      @ekkescorner Thank you.

    • F

      Unsolved my board Time does not change.
      Mobile and Embedded • time board zynq • • ForestPoem

      2
      0
      Votes
      2
      Posts
      593
      Views

      SGaist

      Hi,

      How is that related to Qt ?

    • F

      Unsolved How to localtime get?
      General and Desktop • time qdatetime • • ForestPoem

      3
      0
      Votes
      3
      Posts
      967
      Views

      F

      @jsulm

      QDateTime::currentDateTime is SystemTime

    • L

      [SOLVED] truncating the QTime
      General and Desktop • qtime time • • Lorence

      9
      0
      Votes
      9
      Posts
      2263
      Views

      L

      @mrjj
      sorry, okay im now goign to SOLVED this thread thanks @SGaist @mrjj

    • K

      Qt translator efficiency
      Mobile and Embedded • 4.8 translator embedded time measure • • kumararajas

      6
      0
      Votes
      6
      Posts
      1684
      Views

      SGaist

      I'd say: benchmark it, so you'll know how much time it takes to do the match. Don't forget to load several dictionaries to match real-life setup

    • T

      Implementing a "Time Left" Function
      General and Desktop • time • • Thugzook

      4
      0
      Votes
      4
      Posts
      1997
      Views

      S

      I would suggest taking a look at QElapsedTimer. This class allows you to start a "count up" timer.

      One of the methods of the class is elapsed() which returns the number of milliseconds since the timer was started.

      By knowing how long you want to allow (total time perhaps) and using an elapsed timer with elapsed() the difference between the two will be the remaining time, in milliseconds.

      To convert it to a nice human readable form there are lots of ways but you could simply code up (not the prettiest code, downloaded from a stack overflow post):

      QString ConvertMStoHumanTime( qint64 ms, bool showDays, bool showMS ) { QString Result; double interval; qint64 intval; // Days interval = 24.0 * 60.0 * 60.0 * 1000.0; intval = (qint64)trunc((double)ms / interval); if( intval<0 ) intval = 0; ms -= (qint64)trunc(intval * interval); qint32 days = intval; // Hours interval = 60.0 * 60.0 * 1000.0; intval = (qint64)trunc((double)ms / interval); if( intval<0 ) intval = 0; ms -= (qint64)trunc(intval * interval); qint32 hours = intval; // Minutes interval = 60.0 * 1000.0; intval = (qint64)trunc((double)ms / interval); if( intval<0 ) intval = 0; ms -= (qint64)trunc(intval * interval); qint32 minutes = intval; // Seconds interval = 1000.0; intval = (qint64)trunc((double)ms / interval); if( intval<0 ) intval = 0; ms -= (qint64)trunc(intval * interval); qint32 seconds = intval; // Whatever is left over is milliseconds char buffer[25]; memset( buffer, 0, 25 ); if( showDays ) { if( days<10 ) sprintf_s( buffer, "%d", days ); Result.append( QString("%1d ").arg(buffer) ); } if( hours<10 ) sprintf_s( buffer, "0%d", hours ); else sprintf_s( buffer, "%d", hours ); Result.append( QString("%1:").arg(buffer) ); if( minutes<10 ) sprintf_s( buffer, "0%d", minutes ); else sprintf_s( buffer, "%d", minutes ); Result.append( QString("%1:").arg(buffer) ); if( seconds<10 ) sprintf_s( buffer, "0%d", seconds ); else sprintf_s( buffer, "%d", seconds ); Result.append( QString("%1").arg(buffer) ); if( showMS ) { if( ms<10 ) sprintf_s( buffer, "00%d", ms ); else if( ms<100 ) sprintf_s( buffer, "0%d", ms ); else sprintf_s( buffer, "%d", ms ); Result.append( QString(".%1").arg(buffer) ); } return Result; }