diff options
-rwxr-xr-x | src/time.cpp | 7 | ||||
-rwxr-xr-x | src/time.h | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/time.cpp b/src/time.cpp index 0aa7bd0..4f15cd5 100755 --- a/src/time.cpp +++ b/src/time.cpp @@ -115,6 +115,11 @@ std::ostream& operator<<(std::ostream& stream, const delta& other) { return stream; } +moment timemax(moment a, moment b) { + if (a > b) return a; + return b; +} + // // --- CONSTRUCTORS --- @@ -173,7 +178,7 @@ workday::workday(const moment& previous_wrap, const moment* each_moment = &splitpoints_sorted[i]; //std::cout << "Splitting: " << timeprint(*each_moment) << "\t\tJ: " << j << "\t\tI: " << i << std::endl; // 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) { + if(*each_moment > call && *each_moment < timemax(wrap, call+(delta){0,4,0}) && *each_moment != initial_block.start) { blocks[j++] = timesplit(initial_block, *each_moment); } } @@ -110,3 +110,4 @@ moment timeinput(moment input_moment); moment timeinput(); // TODO: Completely re-write timeinput to be beautiful and enforce valid dates +moment timemax(moment a, moment b);
\ No newline at end of file |