From 9d359582c6c0e7ee06f6408ff3a4de1da41e93cd Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Mon, 21 Feb 2022 18:22:24 -0800
Subject: [PATCH] Timed event "month days" value of 1 means "any day" (same as
 0)

This field should not normally have a value of '1' (no way to configure that, normally, since days are numbered starting at 1 and bit 1 is 2), but if it does, it's treated the same as 0 (any day of the month) - so fix that mismatch in getnexteventtime(). Just noticed this while comparing the logic with the new is_time_to_run() functions in main.cpp. That logic wasn't (should not have) changed, so this mismatch in the treatment of mdays == 1 existed before.
---
 src/sbbs3/data.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sbbs3/data.cpp b/src/sbbs3/data.cpp
index 2271f09299..18a8218540 100644
--- a/src/sbbs3/data.cpp
+++ b/src/sbbs3/data.cpp
@@ -129,7 +129,7 @@ extern "C" time_t getnexteventtime(event_t* event)
 		if(localtime_r(&t, &tm) == NULL)
 			return 0;
 		if((event->days & (1 << tm.tm_wday))
-			&& (event->mdays == 0 || (event->mdays & (1 << tm.tm_mday)))
+			&& (event->mdays <= 1 || (event->mdays & (1 << tm.tm_mday)))
 			&& (event->months == 0 || (event->months & (1 << tm.tm_mon))))
 			break;
 		t += 24 * 60 * 60;
-- 
GitLab