xref: /haiku/src/system/libroot/posix/sys/utimes.c (revision 21470984c891bcd0b31e8a8ee69b09f555de1cd2)
1 /*
2  * Copyright 2006, Axel Dörfler, axeld@pinc-software.de.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <sys/time.h>
8 #include <utime.h>
9 
10 
11 int
12 utimes(const char *file, const struct timeval times[2])
13 {
14 	struct utimbuf buffer, *timeBuffer;
15 
16 	if (times != NULL) {
17 		timeBuffer = &buffer;
18 		buffer.actime = times[0].tv_sec + times[0].tv_usec / 1000000LL;
19 		buffer.modtime = times[1].tv_sec + times[1].tv_usec / 1000000LL;
20 	} else
21 		timeBuffer = NULL;
22 
23 	return utime(file, timeBuffer);
24 }
25 
26