I use this routine in a keyboard filter driver(in a IoComplete callback) to record the time relative to the point when system boots, whenever a key is pressed or released.
I find that the tick count returned by KeQueryTickCount() is periodically zeroed - that is, even if I boot the system a long time ago, the tick count returned by this function will not exceed a number, when multiplied by return value of KeQueueTimeIncrement(), is roughly rounded to 430 seconds. I don’t know why?
The following code segment is within the IoComplete callback routine supplied with the XxxDispatchRead routine:
… … …
LARGE_INTEGER liCurCount;
ULONG ulIncrement;
int nMillSec;
int nSec;
It seems as if the brackets in the expression:
nSec=(int)liCurCount.QuadPart*ulIncrement/10000000;
are misplaced. Try
nSec = (int)(liCurCount.QuadPart * ulIncrement / 10000000);
instead.
Regards,
Volker
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Chong
Sent: Monday, December 20, 2004 10:10 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] KeQueryTickCount-newbie que.
I use this routine in a keyboard filter driver(in a IoComplete callback) to
record the time relative to the point when system boots, whenever a key is
pressed or released.
I find that the tick count returned by KeQueryTickCount() is periodically
zeroed - that is, even if I boot the system a long time ago, the tick count
returned by this function will not exceed a number, when multiplied by
return value of KeQueueTimeIncrement(), is roughly rounded to 430 seconds. I
don’t know why?
The following code segment is within the IoComplete callback routine
supplied with the XxxDispatchRead routine:
… … …
LARGE_INTEGER liCurCount;
ULONG ulIncrement;
int nMillSec;
int nSec;
----- Original Message -----
From: “Chong” Newsgroups: ntdev To: “Windows System Software Devs Interest List” Sent: Monday, December 20, 2004 4:09 PM Subject: [ntdev] KeQueryTickCount-newbie que.
I use this routine in a keyboard filter driver(in a IoComplete callback) to record the time relative to the point when system boots, whenever a key is pressed or released.
I find that the tick count returned by KeQueryTickCount() is periodically zeroed - that is, even if I boot the system a long time ago, the tick count returned by this function will not exceed a number, when multiplied by return value of KeQueueTimeIncrement(), is roughly rounded to 430 seconds. I don’t know why?
The following code segment is within the IoComplete callback routine supplied with the XxxDispatchRead routine:
… … …
LARGE_INTEGER liCurCount; ULONG ulIncrement; int nMillSec; int nSec;
On Mon, 20 Dec 2004 16:50:22 +0700, Chuck Batson
wrote: > Change your assignment to: > > nSec=(int)(liCurCount.QuadPartulIncrement/10000000); > > Note addition of parentheses. > > Chuck > > ----- Original Message ----- > From: “Chong” > Newsgroups: ntdev > To: “Windows System Software Devs Interest List” > Sent: Monday, December 20, 2004 4:09 PM > Subject: [ntdev] KeQueryTickCount-newbie que. > > I use this routine in a keyboard filter driver(in a IoComplete callback) > to record the time relative to the point when system boots, whenever a > key is pressed or released. > > I find that the tick count returned by KeQueryTickCount() is > periodically zeroed - that is, even if I boot the system a long time > ago, the tick count returned by this function will not exceed a number, > when multiplied by return value of KeQueueTimeIncrement(), is roughly > rounded to 430 seconds. I don’t know why? > > The following code segment is within the IoComplete callback routine > supplied with the XxxDispatchRead routine: > > … … … > > LARGE_INTEGER liCurCount; > ULONG ulIncrement; > int nMillSec; > int nSec; > > KeQueryTickCount(&liCurCount); > ulIncrement=KeQueryTimeIncrement(); > nMillSec=(int)(liCurCount.QuadPartulIncrement/10000)%1000; > nSec=(int)liCurCount.QuadPart*ulIncrement/10000000; > > KdPrint((“Time : %d.%d”,nSec, nMillSec)); > … … … > > Then the output of nSec never exceeds 430. > — > Questions? First check the Kernel Driver FAQ at > http://www.osronline.com/article.cfm?id=256 > > You are currently subscribed to ntdev as: unknown lmsubst tag argument: > ‘’ > To unsubscribe send a blank email to xxxxx@lists.osr.com > > — > Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 > > You are currently subscribed to ntdev as: xxxxx@gmail.com > To unsubscribe send a blank email to xxxxx@lists.osr.com >
On Mon, 20 Dec 2004 13:13:08 -0500, Chong Wu wrote: > Thanks Chuck, that’s the problem. It works now. > > > On Mon, 20 Dec 2004 16:50:22 +0700, Chuck Batson > wrote: > > Change your assignment to: > > > > nSec=(int)(liCurCount.QuadPartulIncrement/10000000); > > > > Note addition of parentheses. > > > > Chuck > > > > ----- Original Message ----- > > From: “Chong” > > Newsgroups: ntdev > > To: “Windows System Software Devs Interest List” > > Sent: Monday, December 20, 2004 4:09 PM > > Subject: [ntdev] KeQueryTickCount-newbie que. > > > > I use this routine in a keyboard filter driver(in a IoComplete callback) > > to record the time relative to the point when system boots, whenever a > > key is pressed or released. > > > > I find that the tick count returned by KeQueryTickCount() is > > periodically zeroed - that is, even if I boot the system a long time > > ago, the tick count returned by this function will not exceed a number, > > when multiplied by return value of KeQueueTimeIncrement(), is roughly > > rounded to 430 seconds. I don’t know why? > > > > The following code segment is within the IoComplete callback routine > > supplied with the XxxDispatchRead routine: > > > > … … … > > > > LARGE_INTEGER liCurCount; > > ULONG ulIncrement; > > int nMillSec; > > int nSec; > > > > KeQueryTickCount(&liCurCount); > > ulIncrement=KeQueryTimeIncrement(); > > nMillSec=(int)(liCurCount.QuadPartulIncrement/10000)%1000; > > nSec=(int)liCurCount.QuadPart*ulIncrement/10000000; > > > > KdPrint((“Time : %d.%d”,nSec, nMillSec)); > > … … … > > > > Then the output of nSec never exceeds 430. > > — > > Questions? First check the Kernel Driver FAQ at > > http://www.osronline.com/article.cfm?id=256 > > > > You are currently subscribed to ntdev as: unknown lmsubst tag argument: > > ‘’ > > To unsubscribe send a blank email to xxxxx@lists.osr.com > > > > — > > Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 > > > > You are currently subscribed to ntdev as: xxxxx@gmail.com > > To unsubscribe send a blank email to xxxxx@lists.osr.com > > >