xref: /csrg-svn/lib/libc/gen/utime.c (revision 61111)
145653Sbostic /*-
2*61111Sbostic  * Copyright (c) 1990, 1993
3*61111Sbostic  *	The Regents of the University of California.  All rights reserved.
445653Sbostic  *
545653Sbostic  * %sccs.include.redist.c%
621335Sdist  */
712844Ssam 
826522Sdonn #if defined(LIBC_SCCS) && !defined(lint)
9*61111Sbostic static char sccsid[] = "@(#)utime.c	8.1 (Berkeley) 06/04/93";
1045653Sbostic #endif /* LIBC_SCCS and not lint */
1121335Sdist 
1212845Ssam #include <sys/time.h>
1358502Sbostic 
1445653Sbostic #include <utime.h>
1512844Ssam 
1646597Sdonn int
utime(path,times)1745653Sbostic utime(path, times)
1846597Sdonn 	const char *path;
1946597Sdonn 	const struct utimbuf *times;
2012844Ssam {
2158502Sbostic 	struct timeval tv[2], *tvp;
2212844Ssam 
2358502Sbostic 	if (times) {
2458502Sbostic 		tv[0].tv_sec = times->actime;
2558502Sbostic 		tv[1].tv_sec = times->modtime;
2658502Sbostic 		tv[0].tv_usec = tv[1].tv_usec = 0;
2758502Sbostic 		tvp = tv;
2858502Sbostic 	} else
2958502Sbostic 		tvp = NULL;
3058502Sbostic 	return (utimes(path, tvp));
3112844Ssam }
32