PDA

View Full Version : Timer for application



Zergi
26th December 2007, 21:42
Hi

I have a little problem, i want to create timer for my appliaction witch ll show how long user is using a program. My first idea was currentTime - startingProgramTime, but QTime dosent have operator-... Do u have any ideas how can i create it?

Best Regards

wysota
26th December 2007, 21:43
Take a look at QTime::elapsed().

Zergi
26th December 2007, 22:17
I have 1 more question... Its any function wich is changing int form to time? Because QTime::elapsed() returns int... Do i have to write algoritmic wich ll change ms to s and later s to min?

Best Regards

marcel
26th December 2007, 22:21
Well, not really. You can also construct a null QTime(with the default constructor) and use QTime::addMSecs(startTime.elapsed()), and then convert this to string.