Is there in the QT libraries an equivalent of the timeGetTime() function of the Windows.h header? I wish my code was as platform-independent as possible. I know the <chrono> header exists, but I would like something that returns the value in DWORD
float AudioThread::br()
{
QTime tmp(0,0);
DWORD time = tmp.msecsSinceStartOfDay();
QWORD pos = BASS_StreamGetFilePosition(chan, BASS_FILEPOS_CURRENT);
if (pos != lastpos) {
lasttime = time;
lastpos = pos;
}
}
qDebug() << tmp.msecsSinceStartOfDay() << pos;
return 8.0 * (pos - lastpos) / (time - lasttime);
}
Inserting this code into a QTimer, tmp.msecsSinceStartOfDay() always returns 0
Can you help me?
Thanks in advance
It is a bit hard to guess, what you really want. Looking at your code, you set tmp to 0, afterwards you calculate the difference of tmp(which is still at 0) with 0 (the start of the day) which makes your variable time = 0-0 = 0. Perfectly correct but not what you want. If you want to know, what the current time is, you could use
BTW: I would not use a variable named
timeas this might create confusion with thetime()library function. I have seen very strange behaviour after using a variable named 'time'.