QueryPerformanceCount & QueryPerformancefrequency

just write whatever you want
Post Reply
neji
Posts: 155
Joined: Wed Mar 09, 2005 11:39 am
Contact:

QueryPerformanceCount & QueryPerformancefrequency

Post by neji »

I want to get the Systems uptime WITHOUT using GetTickCount. What opportunities do I have there?

Can I fix this with QueryPerformanceCount?
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

No, but with QueryPerformanceCounter... :D
neji
Posts: 155
Joined: Wed Mar 09, 2005 11:39 am
Contact:

Post by neji »

gna :)

Meinte ich doch......

How can I do this?
I thought of something like

Code: Select all

[...]
var
  uptime, count, freq : Int64;
  
begin
  QueryPerformanceCounter(count);
  QueryPerformanceFrequency(freq);
  uptime := count / freq;
end;
but this gives me nonesense :(
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Why don't you simply use "madExcept.GetSystemUpTime"?

8)
neji
Posts: 155
Joined: Wed Mar 09, 2005 11:39 am
Contact:

Post by neji »

because i want to use this in a commercial application, so I cant use madExcept.

But I think you do it also with QueryPerformanceCounter as I postet above dont you?
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Your code is basically correct. But use "div" instead of "/". The result is the system up time in seconds.
neji
Posts: 155
Joined: Wed Mar 09, 2005 11:39 am
Contact:

Post by neji »

ah in seconds....thats why i get such strange results. I've used MsToStr() to convert the result ;-)
Post Reply