ftime.c 236 B

123456789101112
  1. #include <sys/timeb.h>
  2. #include <time.h>
  3. int ftime(struct timeb *tp)
  4. {
  5. struct timespec ts;
  6. clock_gettime(CLOCK_REALTIME, &ts);
  7. tp->time = ts.tv_sec;
  8. tp->millitm = ts.tv_nsec / 1000000;
  9. tp->timezone = tp->dstflag = 0;
  10. return 0;
  11. }