newlib_stub.c 837 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * File : newlib_stub.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2009 - 2012, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. */
  13. #include <rtthread.h>
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <sys/time.h>
  17. /* some newlib leaked function in CodeSourcery G++ Lite for MIPS version */
  18. int getpid(void)
  19. {
  20. return 0;
  21. }
  22. int gettimeofday(struct timeval *__tp, void *__tzp)
  23. {
  24. struct timespec tp;
  25. if (libc_get_time(&tp) == 0)
  26. {
  27. if (__tp != RT_NULL)
  28. {
  29. __tp->tv_sec = tp.tv_sec;
  30. __tp->tv_usec = tp.tv_nsec * 1000UL;
  31. }
  32. return tp.tv_sec;
  33. }
  34. return 0;
  35. }