Agenradbo.111
net.games.pacman
utzoo!decvax!genradbo!john
Tue Apr  6 14:08:22 1982
Pacman nap call
  At our installation, our system manager refuses to alter
the system in any way, including adding the nap() call.
Therefor I was forced to write a nap subroutine which does
not need to alter the system in any way (4.1BSD)  I am
including the source for anyone who might be interested. (it is
short.)  Actually, our pacman uses a modified version of this
subroutine which begins the sleep BEFORE flushing the output,
and waits for the time to be up after flushing (refresh). This
involves changing the source however.
  Pacman runs just fine using this code, however it really
drags down the system.

#include <SYS/TYPES.H>
#include <SYS/TIMEB.H>

struct timeb gtime;
time_t matchtime;
unsigned short matchmilli;
struct timeb *tp = & gtime;


/* napms - sleep for time milliseconds */
napms(time)
int time;
       {
       ftime(tp);
       matchmilli = tp->millitm + time;
       matchtime  = tp->time;
       if(matchmilli >= 1000)
               {
               ++matchtime;
               matchmilli -= 1000;
               }

       while(1)
               {
               ftime(tp);
               if ((tp->time > matchtime) ||
                       ((tp->time == matchtime) && (tp->millitm >= matchmilli)))
                       break;
               }
       }

-----------------------------------------------------------------
gopher://quux.org/ conversion by John Goerzen <[email protected]>
of http://communication.ucsd.edu/A-News/


This Usenet Oldnews Archive
article may be copied and distributed freely, provided:

1. There is no money collected for the text(s) of the articles.

2. The following notice remains appended to each copy:

The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996
Bruce Jones, Henry Spencer, David Wiseman.