On Wed, 7 Nov 2007 19:27:39 -0300
John Coppens <[EMAIL PROTECTED]> wrote:

> Is there any simple way (short of writing a kernel module) of delaying
> less than the HZ value?

Very unelegant, but it works:

procedure usleep(time: longint);
var
  tv: timeval;
  tz: timezone;
  diff,
  ref: clong;
begin
  fpGetTimeOfDay(@tv, @tz);
  ref := tv.tv_usec;
  repeat
    fpGetTimeOfDay(@tv, @tz);
    diff := tv.tv_usec - ref;
    if diff < 0 then
      diff := diff + 1000000;
  until diff > time;
end;

in case someone is interested.

John
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to