blob: 99d92027b970571fe9203810654466ac290816c0 [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/* vi: set sw=4 ts=4: */
2/*
3 * utimes() 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
10#include <sys/syscall.h>
11#include <utime.h>
12#include <sys/time.h>
13
14
15#ifdef __NR_utimes
16_syscall2(int, utimes, const char *, file, const struct timeval *, tvp)
17#else
18#include <stdlib.h>
19
20
21int utimes(const char *file, const struct timeval tvp[2])
22{
23 struct utimbuf buf, *times;
24
25 if (tvp) {
26 times = &buf;
27 times->actime = tvp[0].tv_sec;
28 times->modtime = tvp[1].tv_sec;
29 } else {
30 times = NULL;
31 }
32 return utime(file, times);
33}
34#endif
35libc_hidden_def(utimes)