gettimeofday.c
上传用户:shenzhenrh
上传日期:2013-05-12
资源大小:2904k
文件大小:0k
源码类别:

信息检索与抽取

开发平台:

Unix_Linux

  1. #include <misc.h>
  2. #include <sys/timeb.h>
  3. #ifdef __MINGW32__
  4. int
  5. gettimeofday (struct timeval *tv, struct timezone *tz)
  6. {
  7.    struct _timeb tb;
  8.    if (!tv)
  9.       return (-1);
  10.   _ftime (&tb);
  11.   tv->tv_sec  = tb.time;
  12.   tv->tv_usec = tb.millitm * 1000 + 500;
  13.   
  14.   if (tz) 
  15.     {
  16.       tz->tz_minuteswest = -60 * _timezone;
  17.       tz->tz_dsttime = _daylight;
  18.     }
  19.   return (0);
  20. }
  21. #endif