Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 1 | #include <utime.h> |
Rich Felker | c37afdf | 2012-05-24 10:55:58 -0400 | [diff] [blame] | 2 | #include <sys/time.h> |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 3 | #include "syscall.h" |
| 4 | |
| 5 | int utime(const char *path, const struct utimbuf *times) |
| 6 | { |
Rich Felker | c37afdf | 2012-05-24 10:55:58 -0400 | [diff] [blame] | 7 | if (times) { |
| 8 | struct timeval tv[2] = { |
| 9 | { .tv_sec = times->actime }, |
| 10 | { .tv_sec = times->modtime } }; |
| 11 | return syscall(SYS_utimes, path, tv); |
| 12 | } |
| 13 | return syscall(SYS_utimes, path, 0); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 14 | } |