stime.c 566 B

1234567891011121314151617181920212223242526272829303132
  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. int stime(const time_t * when)
  17. {
  18. struct timeval tv;
  19. if (when == NULL) {
  20. __set_errno(EINVAL);
  21. return -1;
  22. }
  23. tv.tv_sec = *when;
  24. tv.tv_usec = 0;
  25. return settimeofday(&tv, (struct timezone *) 0);
  26. }
  27. #endif
  28. #endif