stime.c 570 B

123456789101112131415161718192021222324252627282930
  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 "syscalls.h"
  10. #include <time.h>
  11. #include <sys/time.h>
  12. #ifdef __NR_stime
  13. _syscall1(int, stime, const time_t *, t);
  14. #else
  15. libc_hidden_proto(settimeofday)
  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