1
0

ftime32.c 461 B

12345678910111213141516171819202122232425
  1. #include "time32.h"
  2. #include <sys/timeb.h>
  3. #include <errno.h>
  4. #include <stdint.h>
  5. struct timeb32 {
  6. int32_t time;
  7. unsigned short millitm;
  8. short timezone, dstflag;
  9. };
  10. int __ftime32(struct timeb32 *tp)
  11. {
  12. struct timeb tb;
  13. if (ftime(&tb) < 0) return -1;
  14. if (tb.time < INT32_MIN || tb.time > INT32_MAX) {
  15. errno = EOVERFLOW;
  16. return -1;
  17. }
  18. tp->time = tb.time;
  19. tp->millitm = tb.millitm;
  20. tp->timezone = tb.timezone;
  21. tp->dstflag = tb.dstflag;
  22. return 0;
  23. }