diff options
-rwxr-xr-x | src/main.cpp | 29 | ||||
-rwxr-xr-x | src/time.cpp | 7 | ||||
-rwxr-xr-x | src/time.h | 6 |
3 files changed, 37 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp index f1dd13f..99e5647 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -111,12 +111,37 @@ int main(int argc, char* argv[]) std::cout << "Copyright 2022 Sander J. Skjegstad.\n"; std::cout << "This is free software with ABSOLUTELY NO WARRENTY.\n"; std::cout << "It does NOT give financial advice.\n\n"; + + std::cout << "-----\nStep 0: Setting the dayrate\n\n"; + + //int dayrate_input; + //std::cout << "What is your dayrate? "; + //std::cin >> dayrate_input; + const int dayrate = 3338; + std::cout << "Dayrate: " << dayrate << "\n"; + const double hourly_rate = dayrate/7.5; + std::cout << "Hourly rate: " << hourly_rate << "\n\n"; std::cout << "-----\nStep 1: Adding the days\n\n"; - bool not_done = true; - while(not_done) { + while(1) { + std::cout << "Filling in a test-day, and that's it.\n"; + std::cout << "Storing multiple workdays in an efficient way will be figured out later." << std::endl; + + workday test_day({0, 0, 1, 1, 1000}, + {0, 8, 20, 11, 2022}, + {0, 21, 20, 11, 2022}, + {0, 18, 20, 11, 2022}); + + std::cout << "\nCalltime: " << timeprint(test_day.call) << "\n"; + std::cout << "Wraptime: " << timeprint(test_day.wrap) << "\n"; + std::cout << "Planned wrap: " << timeprint(test_day.planned_wrap) << "\n\n"; + + for(int i=0; i<test_day.total_timeblocks; i++) { + std::cout << "Segment " << i << ": " << timeprint(test_day.blocks[i]) << std::endl; + } + break; } return 0; diff --git a/src/time.cpp b/src/time.cpp index 3e65b45..37c0f5f 100755 --- a/src/time.cpp +++ b/src/time.cpp @@ -1,8 +1,9 @@ #include "time.h" // Look. listen here. There's no way I'm going to start taking DST into account. -// I have to draw the line somewhere, and frankly, once you start doing "Change an hour on the 4th moon of the 2nd week of March in France, but only if the tulips haven't sprung... etc... etc.." I'm out. -// The fact that DST is designed this way, though, makes it so you are unlikely to be on the clock during a DST transition. +// DST transition times are decided using skull dice, by the grand wizards of the state. +// The fact that DST is designed this way, though, +// makes it so you are unlikely to be on the clock during a DST transition. // @@ -156,6 +157,8 @@ workday::workday(const moment& previous_wrap, } } + blocks[j++] = initial_block; + total_timeblocks = j; } @@ -54,7 +54,11 @@ struct workday{ moment call; moment wrap; moment planned_wrap; - timeblock blocks[14]; + timeblock blocks[13]; + int total_timeblocks; + // total_timeblocks exsists because blocks[13] can't be shrunk, + // so total_timeblocks is the point at which blocks[13] just contains + // garbage data. // // 1. call // 2. sleepbreach |