xref: /csrg-svn/lib/libc/gen/utime.c (revision 58502)
145653Sbostic /*-
245653Sbostic  * Copyright (c) 1990 The Regents of the University of California.
345653Sbostic  * All rights reserved.
445653Sbostic  *
545653Sbostic  * %sccs.include.redist.c%
621335Sdist  */
712844Ssam 
826522Sdonn #if defined(LIBC_SCCS) && !defined(lint)
9*58502Sbostic static char sccsid[] = "@(#)utime.c	5.5 (Berkeley) 03/05/93";
1045653Sbostic #endif /* LIBC_SCCS and not lint */
1121335Sdist 
1212845Ssam #include <sys/time.h>
13*58502Sbostic 
1445653Sbostic #include <utime.h>
1512844Ssam 
1646597Sdonn int
1745653Sbostic utime(path, times)
1846597Sdonn 	const char *path;
1946597Sdonn 	const struct utimbuf *times;
2012844Ssam {
21*58502Sbostic 	struct timeval tv[2], *tvp;
2212844Ssam 
23*58502Sbostic 	if (times) {
24*58502Sbostic 		tv[0].tv_sec = times->actime;
25*58502Sbostic 		tv[1].tv_sec = times->modtime;
26*58502Sbostic 		tv[0].tv_usec = tv[1].tv_usec = 0;
27*58502Sbostic 		tvp = tv;
28*58502Sbostic 	} else
29*58502Sbostic 		tvp = NULL;
30*58502Sbostic 	return (utimes(path, tvp));
3112844Ssam }
32