Module Name: src
Committed By: dholland
Date: Thu Dec 31 10:18:00 UTC 2015
Modified Files:
src/tests/lib/libutil: t_parsedate.c
Log Message:
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...
To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/lib/libutil/t_parsedate.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/lib/libutil/t_parsedate.c
diff -u src/tests/lib/libutil/t_parsedate.c:1.17 src/tests/lib/libutil/t_parsedate.c:1.18
--- src/tests/lib/libutil/t_parsedate.c:1.17 Thu Dec 31 10:10:15 2015
+++ src/tests/lib/libutil/t_parsedate.c Thu Dec 31 10:18:00 2015
@@ -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 @@ ATF_TC_BODY(relative, tc)
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);