aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSan Jacobs2022-07-28 05:12:34 +0200
committerSan Jacobs2022-07-28 05:12:34 +0200
commit044cdef2122faa384717f98449ec7a4018c14cde (patch)
treedc2c306d334446b956ba894b6dbe6d8f5d44e95a /src
parent6d9d1ef96d4188ad6e5b201b39c31d742c99d147 (diff)
downloadsatscalc-044cdef2122faa384717f98449ec7a4018c14cde.tar.gz
satscalc-044cdef2122faa384717f98449ec7a4018c14cde.tar.bz2
satscalc-044cdef2122faa384717f98449ec7a4018c14cde.zip
Bugfixes
Diffstat (limited to 'src')
-rwxr-xr-xsrc/time.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/time.cpp b/src/time.cpp
index 7a9f5f5..f9a1a6e 100755
--- a/src/time.cpp
+++ b/src/time.cpp
@@ -154,21 +154,22 @@ workday::workday(const moment& previous_wrap,
splitpoints[5] = splitpoints[3];
}
- std::sort(splitpoints, splitpoints + 10);
+ moment splitpoints_sorted[10];
+ std::copy(splitpoints, splitpoints+10, splitpoints_sorted);
+ std::sort(splitpoints_sorted, splitpoints_sorted + 10);
int j = 0;
for(int i = 0; i<10; i++) {
- const moment* each_moment = &splitpoints[i];
+ const moment* each_moment = &splitpoints_sorted[i];
//std::cout << "Splitting: " << timeprint(*each_moment) << "\t\tJ: " << j << "\t\tI: " << i << std::endl;
- if(*each_moment > call && *each_moment < wrap) {
+ // If each splitpoint moment is within the workday, and is not equal to the start of the current block
+ if(*each_moment > call && *each_moment < wrap && *each_moment != initial_block.start) {
blocks[j++] = timesplit(initial_block, *each_moment);
}
}
//std::cout << "Splitting finished." << std::endl;
- // TODO: Clean away all timeblocks that are 0 in length
-
blocks[j++] = initial_block;
total_timeblocks = j;