gettimeofday.c 844 B

123456789101112131415161718192021222324252627282930313233343536
  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. #include "ldso.h"
  11. #ifdef __VDSO_SUPPORT__
  12. typedef int (*gettimeofday_func)(struct timeval * tv, __timezone_ptr_t tz);
  13. #endif
  14. int gettimeofday(struct timeval * tv, __timezone_ptr_t tz) {
  15. #ifdef __VDSO_SUPPORT__
  16. if ( _dl__vdso_gettimeofday != 0 ){
  17. gettimeofday_func func= _dl__vdso_gettimeofday;
  18. return func( tv, tz );
  19. }else{
  20. _syscall2_body(int, gettimeofday, struct timeval *, tv, __timezone_ptr_t, tz)
  21. }
  22. #else
  23. _syscall2_body(int, gettimeofday, struct timeval *, tv, __timezone_ptr_t, tz)
  24. #endif
  25. }
  26. libc_hidden_def(gettimeofday)