LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Arithmetic Overflow Tick Counter with GetLastInputInfo (User32.dll)

Solved!
Go to solution

Hallo evrybody,

 

how can Tick Cout return a lesser value than GetLastInputInfo in the attached vi? When i run that vi, i get sometimes an arithmetic overflow when i substract LastInputInfo Time Value from Tick Counter.

 

I use LabView Base 2015 SP1 (15.0.1f1 32 Bit) On W7 64 bit Proffesional SP1.

 

wladimir

0 Kudos
Message 1 of 4
(3,474 Views)

I ran it for about 30 seconds off and on and wasn't able to replicate it. Only reason I can think is if there is an error in the time on the GetLastInputInfo. Check the two links below which talk about the resolution of that function.

 

https://msdn.microsoft.com/en-us/library/windows/desktop/ms646272(v=vs.85).aspx

https://msdn.microsoft.com/en-us/library/windows/desktop/ms724408(v=vs.85).aspx

Andrew B.
Application Engineer
National Instruments.
http://www.ni.com/support
0 Kudos
Message 2 of 4
(3,439 Views)

I think both Tck Count and LasInputInfo return ms since start of the OS from the same source. So the resolution should not be an issue.

0 Kudos
Message 3 of 4
(3,406 Views)
Solution
Accepted by topic author wladimiripg

I haven't tried it either, but it helps to read the documentation:

 

https://msdn.microsoft.com/en-us/library/windows/desktop/ms646302(v=vs.85).aspx

 

While it doesn't give too many details it does say that it doesn't have to be incremental, so you could get older data (which is not what you're seeing) or you could get data coming from another source (for instance, if someone called SendInput). I have no idea which tick count SendInput uses, but that could certainly provide one scenario which explains what you're seeing.

 

In general, I would say that if you want to compare times, you should make sure you have a canonical time source.


___________________
Try to take over the world!
Message 4 of 4
(3,400 Views)