|
On 12/12/06, M. Lazarus <mlazarus@xxxxxxxx> wrote:
Aaron, If you don't need to go down to the microsecond, sleep() works just fine for whole seconds. -mark
I did not know about usleep( ). Here is a proc I wrote that calls
down to the MI WAITTIME instruction with millisecond granularity. The
WAITTIME instruction itself has a granularity of 16 microseconds.:
** --------------------- fWaitTime ---------------------------------
** use the _WAITTIME instruction to wait with millisecond granularity.
pfWaitTime b export
dfWaitTime pi
d InMilliSecs 10i 0 value
d wt ds likeds(mi_WaitTime_tp)
d ovrly ds qualified
d int8 20i 0
d ch2 2a overlay(int8:1)
d ch6 6a overlay(int8:3)
/free
ovrly.int8 = ( InMilliSecs * 1000 ) / 16 ;
wt.Wait = ovrly.ch6 ;
wt.Fill = x'0000' ;
wt.optns = x'0000' ;
wt.Rsv1 = x'000000000000' ;
mi_WaitTime( wt ) ;
/end-free
** -------------------- mi_WaitTime_tp ------------
** to convert from milliseconds to wait time:
** ( millisecs * 1000 ) / 16
** Wait : units of 16 microseconds
dmi_WaitTime_tp ds qualified
d Wait 6a
d Fill 2a
d Optns 2a
d rsv1 6a
** ---------------------- mi_WaitTime -----------------------
** to convert from milliseconds to wait time:
** ( millisecs * 1000 ) / 16
** Wait : units of 16 microseconds
dmi_WaitTime pr ExtProc('_WAITTIME')
d InTime likeds(mi_waitTime_tp)
-Steve
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.