From fad62714af48c7d0dc31c37abe30ee384c2d80a9 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Mon, 8 Nov 2021 23:34:20 -0500 Subject: [PATCH 1/2] Datetime: Make soww refer to the currently ongoing week --- src/Datetime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Datetime.cpp b/src/Datetime.cpp index baa3244..3df80e8 100644 --- a/src/Datetime.cpp +++ b/src/Datetime.cpp @@ -2002,7 +2002,7 @@ bool Datetime::initializeSoww (Pig& pig) time_t now = time (nullptr); struct tm* t = localtime (&now); - t->tm_mday += 8 - t->tm_wday; + t->tm_mday += 1 - t->tm_wday; t->tm_hour = t->tm_min = t->tm_sec = 0; t->tm_isdst = -1; _date = mktime (t); From c939b0a2f36a61010f9bfb4c5f9a0fda559c8ec2 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Tue, 9 Nov 2021 07:47:25 -0500 Subject: [PATCH 2/2] tests: Adjust tests to properly test assertion that soww < sonww --- test/dates.t.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/dates.t.cpp b/test/dates.t.cpp index 783c38d..3518bbb 100644 --- a/test/dates.t.cpp +++ b/test/dates.t.cpp @@ -265,7 +265,7 @@ int main (int, char**) t.ok (sopww < soww, "sopww < soww"); t.ok (sopy < soy, "sopy < soy"); t.ok (sow < sonw, "sow < sonw"); - t.ok (soww == sonww, "soww == sonww"); + t.ok (soww < sonww, "soww < sonww"); t.ok (soy > sopy, "soy > sopy"); t.ok (today < tomorrow, "today < tomorrow"); t.ok (yesterday < today, "yesterday < today");