From e1005fd4ace41de92fb9d652ce8005cb38e4ec00 Mon Sep 17 00:00:00 2001 From: SanJacobs Date: Fri, 26 Aug 2022 13:20:25 +0200 Subject: Fixed Easter mislocation bug --- src/time.cpp | 24 ++++++++++++------------ src/time.h | 6 +++--- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/time.cpp b/src/time.cpp index 15dd0ce..224a6f0 100755 --- a/src/time.cpp +++ b/src/time.cpp @@ -216,19 +216,19 @@ workday::workday(const moment& previous_wrap, if((each_block.start.day==25 || each_block.start.day==26) && each_block.start.month==12) each_block.upvalue(2, "Christmas"); moment easter = gaussEaster(each_block.start.year); - if(each_block.start.day == (easter-(delta){0,0,-3}).day && - each_block.start.month == (easter-(delta){0,0,-3}).month) each_block.upvalue(2, "Maundy Thursday"); - if(each_block.start.day == (easter-(delta){0,0,-2}).day && - each_block.start.month == (easter-(delta){0,0,-2}).month) each_block.upvalue(2, "Good Friday"); + if(each_block.start.day == (easter-(delta){0,0,3}).day && + each_block.start.month == (easter-(delta){0,0,3}).month) each_block.upvalue(2, "Maundy Thursday"); + if(each_block.start.day == (easter-(delta){0,0,2}).day && + each_block.start.month == (easter-(delta){0,0,2}).month) each_block.upvalue(2, "Good Friday"); if(each_block.start.day == easter.day && each_block.start.month == easter.month) each_block.upvalue(2, "Easter"); - if(each_block.start.day == (easter-(delta){0,0,1}).day && - each_block.start.month == (easter-(delta){0,0,1}).month) each_block.upvalue(2, "Easter"); - if(each_block.start.day == (easter-(delta){0,0,39}).day && - each_block.start.month == (easter-(delta){0,0,39}).month) each_block.upvalue(2, "Feast of the Ascension"); - if(each_block.start.day == (easter-(delta){0,0,49}).day && - each_block.start.month == (easter-(delta){0,0,49}).month) each_block.upvalue(2, "Pentecost"); - if(each_block.start.day == (easter-(delta){0,0,50}).day && - each_block.start.month == (easter-(delta){0,0,50}).month) each_block.upvalue(2, "Pentecost Monday"); + if(each_block.start.day == (easter+(delta){0,0,1}).day && + each_block.start.month == (easter+(delta){0,0,1}).month) each_block.upvalue(2, "Easter"); + if(each_block.start.day == (easter+(delta){0,0,39}).day && + each_block.start.month == (easter+(delta){0,0,39}).month) each_block.upvalue(2, "Feast of the Ascension"); + if(each_block.start.day == (easter+(delta){0,0,49}).day && + each_block.start.month == (easter+(delta){0,0,49}).month) each_block.upvalue(2, "Pentecost"); + if(each_block.start.day == (easter+(delta){0,0,50}).day && + each_block.start.month == (easter+(delta){0,0,50}).month) each_block.upvalue(2, "Pentecost Monday"); } } diff --git a/src/time.h b/src/time.h index 8ff5ecf..52562bd 100755 --- a/src/time.h +++ b/src/time.h @@ -19,9 +19,9 @@ enum weekday{ }; struct delta{ - signed int minutes; - signed int hours; - signed int days; + unsigned int minutes; + unsigned int hours; + unsigned int days; }; std::ostream& operator<<(std::ostream& stream, const delta& other); -- cgit v1.2.1