🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #3240

Re: Short interval timer

#3240
From: scott e garfinkle
Date: Wed, 26 Jun 1991 16:41
25 lines
1794 bytes
In article <1991Jun24.040943.19084@kcbbs.gen.nz> Chris_Sullivan@kcbbs.gen.nz (Chris Sullivan) writes:
>I need to time an interval of several milliseconds.  I can't use the
>Dos timer calls (DosSleep etc) because their granularity is one
>tick of the system closk (30ms).  Is there any way to accurately
>time intervals much less than the system clock period?

I think that there is *no* way to do this under OS/2 1.x.  Under 2.0, you
will get somewhat better resolution if you have a thread designated as
PRTYC_TIMECRITICAL and you set a timer.  In this case the thread, now in
the "fast dispatch" category, will have much better resolution when it 
approaches the end of the timer period.  ("hat resolution," you ask?
I think that this is somewhat in flux, but I think you can probably count
on at least 2-3x better than normal.

In general, by the way, the easiest way to get elapsed time is to use the
DosGetInfoSeg to get a pointer to the ginfoseg.  The "msecs" parameter there
is "current system time in milliseconds."  just save a copy and subtract from
the current value to get elapsed time with millisecond precision (and
whatever accuracy you get, as above).

This is all the stuff I know about.  Someone familiar with the OS/2
kernel may want to improve on this.
	-scott e. garfinkle

Standard Disclaimer.
Technical Details
Message-ID: <1991Jun26.164116.21542@ingres.Ingres.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ucbvax!mtxinu!rtech!ingres!seg
References: <1991Jun24.040943.19084@kcbbs.gen.nz>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ucbvax!mtxinu!rtech!ingres!seg
From: seg@ingres.com (scott e garfinkle)
Newsgroups: comp.os.os2.programmer
Subject: Re: Short interval timer
Message-ID: <1991Jun26.164116.21542@ingres.Ingres.COM>
Date: 26 Jun 91 16:41:15 GMT
References: <1991Jun24.040943.19084@kcbbs.gen.nz>
Organization: Ask Computer Systems, Ingres Products Division
Lines: 25