Introduce macro DAY

DAY(t) is midnight (the day) of time_t t.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lars Henriksen
2020-11-15 10:23:10 +01:00
committed by Lukas Fleischer
parent 0af69778b5
commit 3599766cee
8 changed files with 32 additions and 39 deletions

View File

@@ -100,7 +100,7 @@ int day_sel_index(void)
/* If still not found, stay on the same day. */
VECTOR_FOREACH(&day_items, i) {
p = VECTOR_NTH(&day_items, i);
if (p->order == update_time_in_date(sel_data.order, 0, 0))
if (p->order == DAY(sel_data.order))
return i;
}
return -1;
@@ -832,7 +832,7 @@ int day_paste_item(struct day_item *p, time_t date)
/* wanted: until = shift + old_until */
if (p->item.rapt->rpt->until &&
overflow_add(
date - update_time_in_date(p->item.rapt->start, 0, 0),
date - DAY(p->item.rapt->start),
p->item.rapt->rpt->until,
&until)
)