xref: /original-bsd/lib/libc/gen/utime.c (revision bac379f5)
1 /*-
2  * Copyright (c) 1990, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #if defined(LIBC_SCCS) && !defined(lint)
9 static char sccsid[] = "@(#)utime.c	8.1 (Berkeley) 06/04/93";
10 #endif /* LIBC_SCCS and not lint */
11 
12 #include <sys/time.h>
13 
14 #include <utime.h>
15 
16 int
utime(path,times)17 utime(path, times)
18 	const char *path;
19 	const struct utimbuf *times;
20 {
21 	struct timeval tv[2], *tvp;
22 
23 	if (times) {
24 		tv[0].tv_sec = times->actime;
25 		tv[1].tv_sec = times->modtime;
26 		tv[0].tv_usec = tv[1].tv_usec = 0;
27 		tvp = tv;
28 	} else
29 		tvp = NULL;
30 	return (utimes(path, tvp));
31 }
32