#include <config.h>
#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>
#if TIME_WITH_SYS_TIME
# include <time.h>
#endif
#ifdef HAVE_UTIME_H
# include <utime.h>
#else
# include <emul/utime.h>
#endif
#include <compat.h>
#ifndef lint
__unused static const char rcsid[] = "$Sudo: utimes.c,v 1.10 2008/11/09 14:13:12 millert Exp $";
#endif
#ifndef HAVE_UTIMES
int
utimes(file, times)
const char *file;
const struct timeval *times;
{
if (times != NULL) {
struct utimbuf utb;
utb.actime = (time_t)(times[0].tv_sec + times[0].tv_usec / 1000000);
utb.modtime = (time_t)(times[1].tv_sec + times[1].tv_usec / 1000000);
return(utime(file, &utb));
} else
return(utime(file, NULL));
}
#endif
#ifdef HAVE_FUTIME
int
futimes(fd, times)
int fd;
const struct timeval *times;
{
if (times != NULL) {
struct utimbuf utb;
utb.actime = (time_t)(times[0].tv_sec + times[0].tv_usec / 1000000);
utb.modtime = (time_t)(times[1].tv_sec + times[1].tv_usec / 1000000);
return(futime(fd, &utb));
} else
return(futime(fd, NULL));
}
#endif