diff options
Diffstat (limited to 'src/time.cpp')
-rwxr-xr-x | src/time.cpp | 7 |
1 files changed, 6 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); } } |