stime.c 598 B

123456789101112131415161718192021222324252627282930313233
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * stime() for uClibc
  4. *
  5. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  6. *
  7. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  8. */
  9. #include <sys/syscall.h>
  10. #include <time.h>
  11. #include <sys/time.h>
  12. #ifdef __USE_SVID
  13. #ifdef __NR_stime
  14. _syscall1(int, stime, const time_t *, t)
  15. #else
  16. libc_hidden_proto(settimeofday)
  17. int stime(const time_t * when)
  18. {
  19. struct timeval tv;
  20. if (when == NULL) {
  21. __set_errno(EINVAL);
  22. return -1;
  23. }
  24. tv.tv_sec = *when;
  25. tv.tv_usec = 0;
  26. return settimeofday(&tv, (struct timezone *) 0);
  27. }
  28. #endif
  29. #endif