Re: gettickcount returns a negative number???

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"pithhelmet" <pithhelmet@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C546E136-07D9-4B19-AA6B-E69FEE2D9543@xxxxxxxxxxxxxxxx
>
> so why does the API return a negative number?


From....

Platform SDK: Windows System Information - GetTickCount
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/gettickcount.asp
"The elapsed time is stored as a DWORD value. Therefore, the time will wrap
around to zero if the system is run continuously for 49.7 days."

A VB Long will only go half that far without setting it's sign bit. If the
sign bit's set, it shows as a negative number. There should be plenty of
samples around to convert that to a usable number.

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Please keep all discussions in the groups..


.



Relevant Pages

  • Re: Thread deadlock misery
    ... The real error is not in the GetTickCount() overflow. ... elapsed time by subtracting it. ... It's NOT safe to just compare it. ... The real error is that dwSleepTime is NEVER negative. ...
    (microsoft.public.vc.language)
  • Re: Environment.TickCount - can I trust the documentation?
    ... > The documentation states that Environment.TickCount is a signed integer ... Environment.TickCount and didn't find code like "GetTickCount() & ... > I want to measure elapsed time in a server application which will, I hope, ... the Environment class to measure elapsed ticks. ...
    (microsoft.public.dotnet.framework)
  • Re: calculating run time for portions of code
    ... ColdFusion, there is the function gettickcount(), and you would do ... set starttime = gettickcount ... set endtime = gettickcount ... You can't get the run time, you can get the elapsed time. ...
    (comp.lang.tcl)
  • Re: CTime
    ... How About [GetTickCount] api ... Alok Gupta ... > I'd like to calculate elapsed time. ...
    (microsoft.public.vc.mfc)