Re: GetTickCount
From: Per Larsen (perATportablemindsDOTcom)
Date: 01/26/04
- Next message: Jeremy Collins: "Re: GetTickCount"
- Previous message: Richard Cox: "Re: WinAPI Function to modify EXE resources"
- In reply to: j.munk_at_XremoveXthisXmaccor.com: "GetTickCount"
- Next in thread: Jeremy Collins: "Re: GetTickCount"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 26 Jan 2004 11:35:21 +0100
<j.munk@XremoveXthisXmaccor.com> wrote in message
news:4014e4e5@newsgroups.borland.com...
> Hi,
>
> I have a couple of application with some timing based on the
"GetTickCount"
> API call. Since this function counts milliseconds since the PC was turned
on
> and is a DWord it will roll over every 49.7 days. I would like to check
this
> but rather than having my PC to run continously for 49.7 days, I wonder if
> there is anywhere where this number can be changed. I.e. so I can set it
> close and then see what happens with my programs when it rolls over.
Fake it.
I'm not aware of a way to do what you're asking for directly (though there
may be a way), but what I would do is write a shell routine and call that
instead. Something like this (off the top of my head):
{$IFDEF TestingTimerWrap}
var
TickBias: DWord;
{$ENDIF}
function GetTickCount: DWord;
begin
Result := Windows.GetTickCount;
{$IFDEF TestingTimerWrap}
Result := (Result + TickBias) mod MAXDWORD;
{$ENDIF}
end;
...
{$IFDEF TestingTimerWrap}
initialization
TickBias := MAXDWORD - Windows.GetTickCount - 10000; {or something}
{$ENDIF}
end.
IHTH
- Per
- Next message: Jeremy Collins: "Re: GetTickCount"
- Previous message: Richard Cox: "Re: WinAPI Function to modify EXE resources"
- In reply to: j.munk_at_XremoveXthisXmaccor.com: "GetTickCount"
- Next in thread: Jeremy Collins: "Re: GetTickCount"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|