aboutsummaryrefslogtreecommitdiff
path: root/contrib/netbsd-tests/lib/libc/gen/t_time.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-09-03 19:09:01 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-09-03 19:09:01 +0000
commitc22165b4f1f5d38b681921797a44b3ba8c13b7e0 (patch)
tree252c24b568ad866ae902fd3b64462c1df486afd1 /contrib/netbsd-tests/lib/libc/gen/t_time.c
parent86ea5291326635f26a1f6a923852f706d44a4be1 (diff)
parent2db7b9f259535c36879c35f6c656090034f33101 (diff)
downloadsrc-c22165b4f1f5d38b681921797a44b3ba8c13b7e0.tar.gz
src-c22165b4f1f5d38b681921797a44b3ba8c13b7e0.zip
Merge ^/head r305346 through r305360.
Notes
Notes: svn path=/projects/clang390-import/; revision=305361
Diffstat (limited to 'contrib/netbsd-tests/lib/libc/gen/t_time.c')
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_time.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_time.c b/contrib/netbsd-tests/lib/libc/gen/t_time.c
index 790f3caada48..290540366d1d 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_time.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_time.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_time.c,v 1.2 2011/11/11 05:03:38 jruoho Exp $ */
+/* $NetBSD: t_time.c,v 1.3 2014/10/31 12:22:38 justin Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_time.c,v 1.2 2011/11/11 05:03:38 jruoho Exp $");
+__RCSID("$NetBSD: t_time.c,v 1.3 2014/10/31 12:22:38 justin Exp $");
#ifdef __FreeBSD__
#include <sys/time.h>
@@ -94,15 +94,16 @@ ATF_TC_HEAD(time_timeofday, tc)
ATF_TC_BODY(time_timeofday, tc)
{
struct timeval tv = { 0, 0 };
- time_t t;
+ time_t t1, t2;
- t = time(NULL);
+ t1 = time(NULL);
ATF_REQUIRE(gettimeofday(&tv, NULL) == 0);
+ t2 = time(NULL);
(void)fprintf(stderr, "%"PRId64" vs. %"PRId64"\n",
- (int64_t)t, (int64_t)tv.tv_sec);
+ (int64_t)t1, (int64_t)tv.tv_sec);
- if (t != tv.tv_sec)
+ if (t1 > tv.tv_sec || t2 < tv.tv_sec)
atf_tc_fail("time(3) and gettimeofday(2) differ");
}