home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / programm / 4333 < prev    next >
Encoding:
Text File  |  1992-08-17  |  1.1 KB  |  42 lines

  1. Path: sparky!uunet!mcsun!corton!sophia!taloa!mimosa.unice.fr!tigli
  2. From: tigli@mimosa.unice.fr (Jean-Yves Tigli)
  3. Newsgroups: comp.unix.programmer
  4. Subject: Itimer
  5. Message-ID: <1992Aug17.081500.3915@taloa.unice.fr>
  6. Date: 17 Aug 92 08:15:00 GMT
  7. Sender: news@taloa.unice.fr (Usenet News)
  8. Organization: University of Nice-Sophia Antipolis
  9. Lines: 30
  10. Nntp-Posting-Host: mimosa.unice.fr
  11.  
  12. I work on a Sparc station, and I use "sys/time.h" .
  13. Using "itimerval" type, I set timer value to generate
  14. an interruption according to :
  15.  
  16. struct itimerval *value;
  17.  
  18. value=(struct itimerval*)malloc(10);
  19.  
  20. (value->it_interval).tv_sec=1;
  21. (value->it_interval).tv_usec=0;
  22. (value->it_value).tv_sec=1;
  23. (value->it_value).tv_usec=0;
  24.  
  25. setitimer(timer,value,NULL);
  26.  
  27. When tv_sec > 0, it's OK but ,
  28. when I try to generate an interruption before one second
  29. ( tv_sec = 0) and  tv_usec = ??,  my program emits it always
  30. at the same time : about 10 ms, ignoring tv_usec value.
  31.  
  32. I think it's a classical problem (alarm() from UNIX library 
  33. does it only with seconds), but I don't understand why ?
  34.  
  35. Do you know a work around ?
  36.  
  37. Thanks.
  38.  
  39. tigli@mimosa.unice.fr
  40. I3S Laboratory, FRANCE
  41.   
  42.