diff --git a/man/remind.1 b/man/remind.1 index 4ef99faa..16b2cab5 100644 --- a/man/remind.1 +++ b/man/remind.1 @@ -3132,12 +3132,12 @@ is an implementation artifact. .B SELF-OVERLAPPING EVENTS .PP A multi-day event has the possibility of "overlapping itself". When this -happens, \fBRemind\fR prefers the \fIearlier\fR event (only one copy of +happens, \fBRemind\fR prefers the \fIlater\fR event (only one copy of an event is ever triggered for a given date.) Consider this example: .PP .nf #!/bin/sh - remind - '*4' 11 Feb 1991 <<'EOF' + remind - '*5' 10 Feb 1991 <<'EOF' BANNER % REM MON at 0:00 DURATION 192:0 MSG [today()] [trigeventstart()] [trigduration()]% @@ -3148,17 +3148,16 @@ an event is ever triggered for a given date.) Consider this example: The output is: .PP .nf - 1991-02-11 1991-02-04@00:00 24:00 + 1991-02-10 1991-02-04@00:00 48:00 + 1991-02-11 1991-02-11@00:00 192:00 1991-02-12 1991-02-11@00:00 168:00 1991-02-13 1991-02-11@00:00 144:00 1991-02-14 1991-02-11@00:00 120:00 .fi .PP -Although 1991-02-11 is a Monday (which should cause the event to be -triggered, the 8-day-long event that started on 1991-02-04 \fIhas not -finished yet\fR, so that is the one that is triggered. The next day, -the event starting on 1991-02-04 \fIhas\fR finished, so the 1991-02-11 -event triggers, with a remaining duration of 168:00, or 7 days. +Although the event from 1991-02-04 still has 24 hours left on 1991-02-11, +the fresh occurrence on 1991-02-11 takes precedences and is the one that +is triggered. .PP I do not recommend constructing self-overlapping multi-day events. .PP diff --git a/src/dorem.c b/src/dorem.c index 545658d2..cf648194 100644 --- a/src/dorem.c +++ b/src/dorem.c @@ -1111,6 +1111,18 @@ int DoSatRemind(Trigger *trig, TimeTrig *tt, ParsePtr p) if (r) { if (r == E_CANT_TRIG) return OK; else return r; } + } else if (jul == start) { + if (tt->ttime != NO_TIME) { + trig->eventstart = MINUTES_PER_DAY * r + tt->ttime; + if (tt->duration != NO_TIME) { + trig->eventduration = tt->duration; + } + } + LastTriggerTime = tt->ttime; + SaveLastTimeTrig(tt); + SaveLastTrigger(trig); + LastTriggerDate = r; + LastTrigValid = 1; } if (jul == -1) { return E_EXPIRED; diff --git a/src/trigger.c b/src/trigger.c index 8ff311fc..a665cdf5 100644 --- a/src/trigger.c +++ b/src/trigger.c @@ -479,6 +479,19 @@ int ComputeTrigger(int today, Trigger *trig, TimeTrig *tim, return r; } if (r == today) { + if (tim->ttime != NO_TIME) { + trig->eventstart = MINUTES_PER_DAY * r + tim->ttime; + if (tim->duration != NO_TIME) { + trig->eventduration = tim->duration; + } + } + if (save_in_globals) { + LastTriggerTime = tim->ttime; + SaveLastTimeTrig(tim); + SaveLastTrigger(trig); + LastTriggerDate = r; + LastTrigValid = 1; + } return r; }