diff options
author | San Jacobs | 2024-01-02 12:00:47 +0100 |
---|---|---|
committer | San Jacobs | 2024-01-02 12:00:47 +0100 |
commit | 0a51fac9f3a60ecfa647ad7aeb179c310dca3606 (patch) | |
tree | 6d0d4b3e3c375f680edb93a2fe9ebf69c0dd5c96 /src | |
parent | 5b3537db08f98372acdd3b5e22c42441132355c7 (diff) | |
download | satscalc-0a51fac9f3a60ecfa647ad7aeb179c310dca3606.tar.gz satscalc-0a51fac9f3a60ecfa647ad7aeb179c310dca3606.tar.bz2 satscalc-0a51fac9f3a60ecfa647ad7aeb179c310dca3606.zip |
Fixed 4-hour minimum bug referenced in 5f685eaabf4
Diffstat (limited to 'src')
-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 |