aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanJacobs2022-08-26 13:20:25 +0200
committerSanJacobs2022-08-26 13:20:25 +0200
commite1005fd4ace41de92fb9d652ce8005cb38e4ec00 (patch)
tree00a6c62fea61cf156bfdd64384b289fb59bc3618
parentd4488cd88486ae4aaeac20fc7397942c00f0e1bc (diff)
downloadsatscalc-e1005fd4ace41de92fb9d652ce8005cb38e4ec00.tar.gz
satscalc-e1005fd4ace41de92fb9d652ce8005cb38e4ec00.tar.bz2
satscalc-e1005fd4ace41de92fb9d652ce8005cb38e4ec00.zip
Fixed Easter mislocation bug
-rwxr-xr-xsrc/time.cpp24
-rwxr-xr-xsrc/time.h6
-rwxr-xr-xtest.sh4
3 files changed, 18 insertions, 16 deletions
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);
diff --git a/test.sh b/test.sh
index 8b4bbca..ebf8ce6 100755
--- a/test.sh
+++ b/test.sh
@@ -1,6 +1,6 @@
./satscalc <<EOF-MARKER
3462
-12
+13
0
2022 09 15 22 00
w
@@ -62,5 +62,7 @@ p
0
2030 04 22 08 00
0
+2030 05 17 08 00
+0
EOF-MARKER