aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanJacobs2022-07-13 00:57:58 +0200
committerSanJacobs2022-07-13 00:57:58 +0200
commit2f97c1e2cac065443734e94ae1346da2f1d648d1 (patch)
treeb648dc1468daf218d83dab4a1551c0cf8b41cca0
parent82d45f2a532008d8d7c05ca57fbae6bd48e35352 (diff)
downloadsatscalc-2f97c1e2cac065443734e94ae1346da2f1d648d1.tar.gz
satscalc-2f97c1e2cac065443734e94ae1346da2f1d648d1.tar.bz2
satscalc-2f97c1e2cac065443734e94ae1346da2f1d648d1.zip
Squashed a couple bugs
Fixed: - Splitpoints in workday constructor was generating backwards timeblocks, - Planned wrap could cut up main chunk of workday.
-rwxr-xr-xsrc/time.cpp9
-rwxr-xr-xsrc/time.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/src/time.cpp b/src/time.cpp
index 9ecdc69..45d5c48 100755
--- a/src/time.cpp
+++ b/src/time.cpp
@@ -147,6 +147,15 @@ workday::workday(const moment& previous_wrap,
(moment){0, 23, call.day, call.month, call.year}+(delta){0, 7, 0}, // 6, next morning
};
+ // Eliminate planned wrap, if it occurs within normal 8-hour period.
+ // This is to make sure the first period of time becomes a pure 8 hours,
+ // which makes detecting the main section of the workday easier.
+ if(splitpoints[5] < splitpoints[3]){
+ splitpoints[5] = splitpoints[3];
+ }
+
+ std::sort(splitpoints, splitpoints + 10);
+
int j = 0;
for(int i = 0; i<=10; i++) {
const moment* each_moment = &splitpoints[i];
diff --git a/src/time.h b/src/time.h
index fc5dcbc..17a6854 100755
--- a/src/time.h
+++ b/src/time.h
@@ -5,6 +5,7 @@
#include <iomanip>
#include <string.h>
#include <vector>
+#include <bits/stdc++.h>
enum weekday{
monday,