stime.c 532 B

12345678910111213141516171819202122232425262728
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * stime() for uClibc
  4. *
  5. * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
  6. *
  7. * GNU Library General Public License (LGPL) version 2 or later.
  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. int stime(const time_t * when)
  16. {
  17. struct timeval tv;
  18. if (when == NULL) {
  19. __set_errno(EINVAL);
  20. return -1;
  21. }
  22. tv.tv_sec = *when;
  23. tv.tv_usec = 0;
  24. return settimeofday(&tv, (struct timezone *) 0);
  25. }
  26. #endif