[Qt-interest] how do use the timer to calculate the time duration

Yuvaraj R yuvaraj at ongobiz.com
Mon Jun 22 21:17:14 CEST 2009


As per my requirement..

When i am clicking the accept call button that time timer will be starting..

When i am clicking the end call  button that time time will be stoping.

if i use the timer->elapsed( method.. it gives the one call duration time
only..

if i calculate duration for next call , it keep on running ,,, it is not
resetting ...

How do stop the timer,if once i click the end call button

On Tue, Jun 23, 2009 at 12:36 AM, Ferenc Stelcz <ferenc at stelcz.hu> wrote:

> Yuvaraj R wrote:
> > Hi
> >
> >  how do i stop the timer...
> >
> > once i calculated the time...
> >
> > there is no methed to stop the timer
> > On Mon, Jun 22, 2009 at 11:29 PM, Ferenc Stelcz <ferenc at stelcz.hu>
> wrote:
> >
> >>  Yuvaraj R wrote:
> >>> Hi All
> >>>
> >>> I want to calculate the  task completion time..
> >>>
> >>>   So   How do use the timer to calculate the time duration..
> >>>
> >>>
> >>> Thanks
> >>>
> >>> Yuvaraj R
> >>>
> >> There are more and more of "your" ermmm.. kind of "developers"... :D
> >>
> >> Assistant -> Search -> "QTime" -> void QTime::start();
> >>
> >> from the 2nd line:
> >>
> >> QTime t;
> >> t.start();
> >> some_lengthy_task();
> >> qDebug("Time elapsed: %d ms", t.elapsed());
> >>
>
> Please do NOT reply to me personally! PLEASE reply to the list at the
> address:
> qt-interest at trolltech.com and NOT qt-interest-subscribe at trolltech.com.
>
> As for your question:
>
> How would you do it in plain C++?
>
> You call t.start() then an ??internal timer?? gets started. (I'm have
> almost
> never had a look at Qt's internal source, so you'll be at your own from
> this
> point...) As soon as you call t.elapsed() this timer is stopped and the
> time
> difference in milliseconds between the start and finish time is returned.
> You
> don't have to stop it. It's done for you!
>
> so:
>
> QTime t;
> t.start();
> /*
>        do
>        your
>        job
>        here
> */
> qDebug("My job took ( %d ) milliseconds to execute.", t.elapsed());
>
> --
> Ferenc Stelcz
> Junior Software Engineer
>
> Banyan Technologies LLC.
>
>
> __________ Information from ESET Smart Security, version of virus signature
> database 4177 (20090622) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090623/cb4d86d7/attachment.html 


More information about the Qt-interest-old mailing list