2011-04-19 Giuseppe Scrivano <gscrivano@gnu.org>
+ * Makefile.am (LIBS): Add $(LIB_CLOCK_GETTIME)
+ * utils.c: Include <sys/stat.h>. Do not include <sys/time.h>.
+ (touch): Use `futimens' instead of `utimes'.
+
* mswindows.h: Do not include <direct.h>. Remove macro definition for
mkdir.
# The following line is losing on some versions of make!
DEFS = @DEFS@ -DSYSTEM_WGETRC=\"$(sysconfdir)/wgetrc\" -DLOCALEDIR=\"$(localedir)\"
-LIBS = @LIBICONV@ @LIBINTL@ @LIBS@
+LIBS = @LIBICONV@ @LIBINTL@ @LIBS@ $(LIB_CLOCK_GETTIME)
bin_PROGRAMS = wget
wget_SOURCES = cmpt.c connect.c convert.c cookies.c ftp.c \
#include <stdarg.h>
#include <locale.h>
-#include <sys/time.h>
-
+#include <sys/stat.h>
/* For TIOCGWINSZ and friends: */
#ifdef HAVE_SYS_IOCTL_H
void
touch (const char *file, time_t tm)
{
- struct timeval timevals[2];
+ struct timespec timespecs[2];
+ int fd;
+
+ fd = open (file, O_WRONLY);
+ if (fd < 0)
+ {
+ logprintf (LOG_NOTQUIET, "open(%s): %s\n", file, strerror (errno));
+ return;
+ }
+
+ timespecs[0].tv_sec = time (NULL);
+ timespecs[0].tv_nsec = 0L;
+ timespecs[1].tv_sec = tm;
+ timespecs[1].tv_nsec = 0L;
- timevals[0].tv_sec = time (NULL);
- timevals[0].tv_usec = 0L;
- timevals[1].tv_sec = tm;
- timevals[1].tv_usec = 0L;
+ if (futimens (fd, timespecs) == -1)
+ logprintf (LOG_NOTQUIET, "futimens(%s): %s\n", file, strerror (errno));
- if (utimes (file, timevals) == -1)
- logprintf (LOG_NOTQUIET, "utimes(%s): %s\n", file, strerror (errno));
+ close (fd);
}
/* Checks if FILE is a symbolic link, and removes it if it is. Does
+2011-04-19 Giuseppe Scrivano <gscrivano@gnu.org>
+
+ * Makefile.am (LIBS): Add $(LIB_CLOCK_GETTIME).
+
2011-04-04 Giuseppe Scrivano <gscrivano@gnu.org>
* Makefile.am (LIBS): Remove @LIBSSL@ @W32LIBS@