Questions tagged [qtime]

The QTime class provides clock time functions in Qt Framework.

The QTime class provides clock time functions. All functions in this class are reentrant.

An object of Qt class can be used to provide various measurements related to system time. This class contains APIs to compare time, measure elapsed time and manipulate the time values. QTime uses 24 hour time format and have a granularity of hours, minutes, seconds, and milliseconds.

26 questions
14
votes
4 answers

Getting milliseconds accuracy current time in Qt

Qt documentation about QTime::currentTime() says : Note that the accuracy depends on the accuracy of the underlying operating system; not all systems provide 1-millisecond accuracy. But is there any way to get this time with milliseconds…
HMD
  • 2,202
  • 6
  • 24
  • 37
5
votes
2 answers

How to measure function running time in Qt?

I am calling argon2 - memory intensive hashing function in Qt and measuring its running time: ... QTime start = QTime::currentTime(); // call hashing function QTime finish = QTime::currentTime(); time = start.msecsTo(finish) / 1000.0; ... In argon2…
Bobur
  • 545
  • 1
  • 6
  • 21
4
votes
3 answers

What is the cleanest way to translate 42010958 Milliseconds to Hours:Minutes:Seconds in Qt?

The QTime Class offers me a bit of a pickle insofar as it does not allow me to set milliseconds above certain values, thus making an entry like this invalid.: QTime time; time.setHMS(0,0,0,42010958); // I normally use a variable Considering…
Anon
  • 2,267
  • 3
  • 34
  • 51
3
votes
1 answer

Using QTime as X asis in QwtPlot

I am trying to draw velocity-time graphics using qwtplot. My X datas are QTime values and Y datas are corresponding speed values. I could not find any example on drawing plots with QTime. Can anyone simply explain how to draw QTime versus Y data ?…
Muhammet Ali Asan
  • 1,486
  • 22
  • 39
2
votes
0 answers

Python, QTimer and multiprocessing Pipe

I have two classes: class Bullet and Main Class. I need to the create movement of bullet and I did that, but when bullet moves out of screen I don`t know how to stop function for the moving bullet. Because of that, the program with time gets…
Filip Filipovic
  • 410
  • 3
  • 13
2
votes
2 answers

How can i make a time counter using QTime()

I am trying to do a time counter in python using QTime and show this time in a QLabel using PyQt. I need to do this, to show how many time has passed since my program started to work, using this format of time: 00:00:00. I read the docs of QTime and…
Pablo Flores
  • 667
  • 1
  • 13
  • 33
2
votes
2 answers

How to set timezone in Qt?

Can someone show me how to set time zone in Qt? Currently I am using the linux system() call to set the time zone, but this is not reflecting in currentTime() API of Qt. There is a setTimeZone() API in Qt 5 and above but I have no idea how to use…
jxgn
  • 741
  • 2
  • 15
  • 36
1
vote
1 answer

using QTime and Qtimer as clock in Qlabel lead to heavy cpu usage

I have Problem when i activate QTimer To Show A clock inside a Qlabel, my small software will use around 25 to 40 % of CPU Power (I3 4160) so how to solve it to take less hardware resources? QTimer *timer1 = new QTimer(this); …
Oliver07
  • 13
  • 2
1
vote
0 answers

How to properly implement a count down timer in a QLabel

In order to shrink the problem I created a minimal verifiable example below. I am trying to implement a 60 minutes count down using a QLabel. The problem I have is that instead of seeing the time going back, I see the the current time going…
Emanuele
  • 2,194
  • 6
  • 32
  • 71
1
vote
1 answer

C++ / Qt QTime - How to use the object

this is more a generell C++ beginner Question: I have 2 classes: Class A, including a 'ReadData' Method, which is called as soon as new Data is received by a TCP Socket Class B, including a Method 'Start' which is sending big amounts of data via…
1
vote
1 answer

Static Qtime Default Value

I have method. This method have static QTime but I want to reset this value if something is happened. static QTime time(QTime::currentTime()); // calculate two new data points: double key = time.elapsed()/1000; static double lastPointKey =…
1
vote
2 answers

QTime add seconds to new object

I am using QT5.51. Why is t1 invalid?: QTime t1 = QTime().addSecs(122); qDebug() << t1.isValid() << t1.toString("hh:mm:ss"); I expected to get "00:02:02" , but I get false "".
Paul G.
  • 461
  • 6
  • 21
1
vote
2 answers

QTimeDate::currentDateTime not working as expected

i'm trying to use QDateTime for one of my project. But everything is going wrong when i use QDateTime::currentTime().msecsTo() .... QString FORMAT = "d/MM/yy hh:mm:ss"; QDateTime at = QDateTime::fromString("30/06/15 12:00:00", FORMAT); qDebug() <<…
0
votes
0 answers

C++ QTDatetime output is not consistent

I have this function, written in C++ using QTcreator, to return the current time of the system being used. void cLogDataBase::writetime() { QString Str; Str = QDateTime::currentDateTime().toString("hh:mm:ss.zzz"); writestr(Str); } My…
Adam Gong
  • 41
  • 5
0
votes
1 answer

Python PyQt5 - Convert QTime to python time object

I have to solve this error: day_frequency_parameters = self.main_self.ui_scheduled_transmitions_create_window.daily_one_time_timeEdit.time().strftime('%H:%M:%S') AttributeError: 'QTime' object has no attribute 'strftime' where…
Chris P
  • 2,059
  • 4
  • 34
  • 68
1
2