/*
- * Copyright (c) 2004 Todd C. Miller <Todd.Miller@courtesan.com>
+ * Copyright (c) 2004-2005, 2007 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <config.h>
+
#include <sys/types.h>
#include <sys/time.h>
-#include <time.h>
#include <stdio.h>
-
-#include "config.h"
+#if TIME_WITH_SYS_TIME
+# include <time.h>
+#endif
#ifdef HAVE_UTIME_H
# include <utime.h>
# include <emul/utime.h>
#endif
-#ifndef lint
-static const char rcsid[] = "$Sudo: utimes.c,v 1.3 2004/09/11 16:24:28 millert Exp $";
-#endif /* lint */
+#include <compat.h>
#ifndef HAVE_UTIMES
/*
if (times != NULL) {
struct utimbuf utb;
- utb.actime = (time_t)times[0].tv_sec;
- utb.modtime = (time_t)times[1].tv_sec;
+ 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));
if (times != NULL) {
struct utimbuf utb;
- utb.actime = (time_t)times[0].tv_sec;
- utb.modtime = (time_t)times[1].tv_sec;
+ 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));