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