gettimeofday.c 874 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * gettimeofday() for uClibc
  3. *
  4. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. */
  8. #include <sys/syscall.h>
  9. #include <sys/time.h>
  10. #ifdef __VDSO_SUPPORT__
  11. #include "ldso.h"
  12. #endif
  13. #ifdef __VDSO_SUPPORT__
  14. typedef int (*gettimeofday_func)(struct timeval * tv, __timezone_ptr_t tz);
  15. #endif
  16. int gettimeofday(struct timeval * tv, __timezone_ptr_t tz) {
  17. #ifdef __VDSO_SUPPORT__
  18. if ( _dl__vdso_gettimeofday != 0 ){
  19. gettimeofday_func func= _dl__vdso_gettimeofday;
  20. return func( tv, tz );
  21. }else{
  22. _syscall2_body(int, gettimeofday, struct timeval *, tv, __timezone_ptr_t, tz)
  23. }
  24. #else
  25. _syscall2_body(int, gettimeofday, struct timeval *, tv, __timezone_ptr_t, tz)
  26. #endif
  27. }
  28. libc_hidden_def(gettimeofday)