Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convert QTime into seconds

Tags:

c++

qt

How do I convert a QTime into seconds? I've set the time manually with time.setHMS(0,1,0);

Now when I convert this variable time into an integer, I want to get 60 seconds. How do I accomplish this?

like image 708
Alen Avatar asked May 10 '13 17:05

Alen


2 Answers

You can do this:

int seconds = QTime(0, 0, 0).secsTo(time);
like image 73
jxh Avatar answered Oct 03 '22 20:10

jxh


Try to use int seconds = QTime(0,0).secsTo(time); It works in Qt 5.3.0

like image 45
Eugene Andritskiy Avatar answered Oct 03 '22 21:10

Eugene Andritskiy