diff options
author | Renato Botelho <renato@netgate.com> | 2017-02-23 06:28:41 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-02-23 06:28:41 -0300 |
commit | 82ceeb2ea625cd9bff60f2863b9a0830f55b7905 (patch) | |
tree | 263ca9347bf664a4489743f9302e699ce14de1df /contrib/netbsd-tests/lib/libc/gen/t_time.c | |
parent | 4a05f5440acda223e6a0ec5157bc32ecc0f09ff9 (diff) | |
parent | d20dd8b36e7a565be7bfbb22aade51c8ffd753e9 (diff) | |
download | FreeBSD-src-82ceeb2ea625cd9bff60f2863b9a0830f55b7905.zip FreeBSD-src-82ceeb2ea625cd9bff60f2863b9a0830f55b7905.tar.gz |
Merge remote-tracking branch 'origin/stable/10' into develdevel
Diffstat (limited to 'contrib/netbsd-tests/lib/libc/gen/t_time.c')
-rw-r--r-- | contrib/netbsd-tests/lib/libc/gen/t_time.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_time.c b/contrib/netbsd-tests/lib/libc/gen/t_time.c index 790f3ca..15a8d58 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.4 2017/01/10 15:32:46 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,11 +29,8 @@ * 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.4 2017/01/10 15:32:46 christos Exp $"); -#ifdef __FreeBSD__ -#include <sys/time.h> -#endif #include <atf-c.h> #include <errno.h> #include <inttypes.h> @@ -41,6 +38,7 @@ __RCSID("$NetBSD: t_time.c,v 1.2 2011/11/11 05:03:38 jruoho Exp $"); #include <stdio.h> #include <stdlib.h> #include <time.h> +#include <sys/time.h> #include <unistd.h> ATF_TC(time_copy); @@ -94,15 +92,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"); } |