home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / news / cnews.tar / libfake / gettimeofday.c < prev    next >
C/C++ Source or Header  |  1995-04-27  |  520b  |  25 lines

  1. /*
  2.  * fake gettimeofday
  3.  *
  4.  * You might think that times() could be used to get sub-second timer
  5.  * resolution, but apart from miscellaneous practical problems, there
  6.  * is no guarantee that its second boundaries are the same as time()'s.
  7.  */
  8.  
  9. #include <sys/types.h>
  10. #include <time.h>
  11. #include <sys/time.h>
  12. #include <stdlib.h>
  13.  
  14. /* ARGSUSED */
  15. int
  16. gettimeofday(tvp, tzp)
  17. struct timeval *tvp;
  18. struct timezone *tzp;
  19. {
  20.     (void) time(&tvp->tv_sec);
  21.     tvp->tv_usec = 0;        /* no good alternative */
  22.  
  23.     /* assert(tzp == NULL); */
  24. }
  25.