Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libutil When evaluated on a Sunday, "next Sunday" ...



details:   https://anonhg.NetBSD.org/src/rev/c84fc5cf7ec9
branches:  trunk
changeset: 342601:c84fc5cf7ec9
user:      dholland <dholland%NetBSD.org@localhost>
date:      Thu Dec 31 10:18:00 2015 +0000

description:
When evaluated on a Sunday, "next Sunday" means 7 days in the future,
not 14. When evaluated on a Monday, it apparently means 13 days in the
future. There's not exactly a spec for parsedate.y, so conform to the
implementation.

PR 50574.

XXX: to me at least this is an odd notion of "next Sunday", but whatever...

diffstat:

 tests/lib/libutil/t_parsedate.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 08319bc3cc8b -r c84fc5cf7ec9 tests/lib/libutil/t_parsedate.c
--- a/tests/lib/libutil/t_parsedate.c   Thu Dec 31 10:10:15 2015 +0000
+++ b/tests/lib/libutil/t_parsedate.c   Thu Dec 31 10:18:00 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_parsedate.c,v 1.17 2015/12/31 10:10:15 dholland Exp $ */
+/* $NetBSD: t_parsedate.c,v 1.18 2015/12/31 10:18:00 dholland Exp $ */
 /*-
  * Copyright (c) 2010, 2015 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_parsedate.c,v 1.17 2015/12/31 10:10:15 dholland Exp $");
+__RCSID("$NetBSD: t_parsedate.c,v 1.18 2015/12/31 10:18:00 dholland Exp $");
 
 #include <atf-c.h>
 #include <errno.h>
@@ -283,7 +283,7 @@
        REL_CHECK("this thursday", now, tm);
 
        ATF_CHECK(localtime_r(&now, &tm) != NULL);
-       tm.tm_mday += 14 - tm.tm_wday;
+       tm.tm_mday += 14 - (tm.tm_wday ? tm.tm_wday : 7);
        tm.tm_sec = tm.tm_min = tm.tm_hour = 0;
        tm.tm_isdst = -1;
        REL_CHECK("next sunday", now, tm);



Home | Main Index | Thread Index | Old Index