🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.nativeapi
Article #243

Re: GetTickCount

#243
From: Per Larsen
Date: Mon, 26 Jan 2004 10:35
44 lines
2019 bytes
<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
Technical Details
Message-ID: <4014ece6@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4014e4e5@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f94dd,5baf55b70f2174fa
X-Google-Attributes: gidf94dd,public
X-Google-ArrivalTime: 2004-01-26 02:39:30 PST
From: "Per Larsen" <perATportablemindsDOTcom>
Newsgroups: borland.public.delphi.nativeapi
References: <4014e4e5@newsgroups.borland.com>
Subject: Re: GetTickCount
Date: Mon, 26 Jan 2004 11:35:21 +0100
Lines: 46
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 80.162.105.201
Message-ID: <4014ece6@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1075113190 80.162.105.201 (26 Jan 2004 02:33:10 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail