adjtime32.c 508 B

123456789101112131415161718192021
  1. #define _GNU_SOURCE
  2. #include "time32.h"
  3. #include <time.h>
  4. #include <sys/time.h>
  5. #include <sys/timex.h>
  6. int __adjtime32(const struct timeval32 *in32, struct timeval32 *out32)
  7. {
  8. struct timeval out;
  9. int r = adjtime((&(struct timeval){
  10. .tv_sec = in32->tv_sec,
  11. .tv_usec = in32->tv_usec}), &out);
  12. if (r) return r;
  13. /* We can't range-check the result because success was already
  14. * committed by the above call. */
  15. if (out32) {
  16. out32->tv_sec = out.tv_sec;
  17. out32->tv_usec = out.tv_usec;
  18. }
  19. return r;
  20. }