summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/make/timestamp.c8
-rw-r--r--usr.bin/make/timestamp.h9
-rw-r--r--usr.bin/make/util.c6
3 files changed, 8 insertions, 15 deletions
diff --git a/usr.bin/make/timestamp.c b/usr.bin/make/timestamp.c
index 275fda17c2a..6617a902878 100644
--- a/usr.bin/make/timestamp.c
+++ b/usr.bin/make/timestamp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: timestamp.c,v 1.6 2010/07/19 19:46:44 espie Exp $ */
+/* $OpenBSD: timestamp.c,v 1.7 2011/12/10 04:12:36 guenther Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
@@ -39,11 +39,7 @@ int
set_times(const char *f)
{
#ifdef USE_TIMESPEC
- struct timeval tv[2];
-
- gettimeofday(&tv[0], NULL);
- tv[1] = tv[0];
- return utimes(f, tv);
+ return utimes(f, NULL);
#else
struct utimbuf times;
diff --git a/usr.bin/make/timestamp.h b/usr.bin/make/timestamp.h
index 376ffa86cdf..1ff95e5acd4 100644
--- a/usr.bin/make/timestamp.h
+++ b/usr.bin/make/timestamp.h
@@ -1,7 +1,7 @@
#ifndef TIMESTAMP_H
#define TIMESTAMP_H
-/* $OpenBSD: timestamp.h,v 1.6 2010/07/19 19:46:44 espie Exp $ */
+/* $OpenBSD: timestamp.h,v 1.7 2011/12/10 04:12:36 guenther Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
@@ -69,12 +69,7 @@ do { \
if (is_out_of_date(t)) \
(t).tv_nsec++; \
} while (0)
-#define ts_set_from_now(n) \
-do { \
- struct timeval tv; \
- gettimeofday(&tv, NULL); \
- TIMEVAL_TO_TIMESPEC(&(tv), &n); \
-} while (0)
+#define ts_set_from_now(n) clock_gettime(CLOCK_REALTIME, &(n))
#define timestamp2time_t(t) ((t).tv_sec)
#else
#define is_out_of_date(t) ((t) == INT_MIN)
diff --git a/usr.bin/make/util.c b/usr.bin/make/util.c
index caf72848ff3..f6d91525f4e 100644
--- a/usr.bin/make/util.c
+++ b/usr.bin/make/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.25 2010/07/19 19:46:44 espie Exp $ */
+/* $OpenBSD: util.c,v 1.26 2011/12/10 04:12:36 guenther Exp $ */
/* $NetBSD: util.c,v 1.10 1996/12/31 17:56:04 christos Exp $ */
/*
@@ -332,10 +332,12 @@ char *sys_siglist[] = {
int
utimes(file, tvp)
char *file;
- struct timeval tvp[2];
+ struct timeval *tvp;
{
struct utimbuf t;
+ if (tvp == NULL)
+ return utime(file, NULL);
t.actime = tvp[0].tv_sec;
t.modtime = tvp[1].tv_sec;
return utime(file, &t);