aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanJacobs2022-04-15 17:20:37 +0200
committerSanJacobs2022-04-15 17:20:37 +0200
commit02369bb5b4f027d1f2545b7db6456d36a2c7d47a (patch)
tree6725a4cca2d35a6e55646de8d8eb1fab2ef2544d
parentd9d505865604a4d136e143dd5186ade0baaf452e (diff)
downloadsatscalc-02369bb5b4f027d1f2545b7db6456d36a2c7d47a.tar.gz
satscalc-02369bb5b4f027d1f2545b7db6456d36a2c7d47a.tar.bz2
satscalc-02369bb5b4f027d1f2545b7db6456d36a2c7d47a.zip
timeprint() can now handle timeblocks
-rwxr-xr-xsrc/main.cpp6
-rwxr-xr-xsrc/time.cpp5
-rwxr-xr-xsrc/time.h2
3 files changed, 10 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index c6e26d3..3ae2f4b 100755
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -42,7 +42,7 @@ int main()
std::cout << "Wraptime: " << timeprint(wraptime) << std::endl;
std::cout << "\nWorkday:\n";
- std::cout << timeprint(workday.start) << " --> " << timeprint(workday.end) << std::endl;
+ std::cout << timeprint(workday) << std::endl;
std::cout << "\nSplitting workday into workday and second_half...\n";
moment splitpoint{0, 12, 27, 11, 2010};
@@ -50,9 +50,9 @@ int main()
std::cout << "\nSplitpoint: " << timeprint(splitpoint) << std::endl;
std::cout << "\nWorkday:\n";
- std::cout << timeprint(workday.start) << " --> " << timeprint(workday.end) << std::endl;
+ std::cout << timeprint(workday) << std::endl;
std::cout << "\nSecond_half:\n";
- std::cout << timeprint(second_half.start) << " --> " << timeprint(second_half.end) << std::endl;
+ std::cout << timeprint(second_half) << std::endl;
std::cout << "\n\n --- TIME MATH TEST ---\n\n";
diff --git a/src/time.cpp b/src/time.cpp
index 0d97a09..1262d57 100755
--- a/src/time.cpp
+++ b/src/time.cpp
@@ -75,6 +75,11 @@ std::string timeprint(moment input_moment) {
return output;
}
+std::string timeprint(timeblock input_timeblock) {
+ std::string output{timeprint(input_timeblock.start) + " --> " + timeprint(input_timeblock.end)};
+ return output;
+}
+
int days_in(int month, int year) {
// Kind of a stupid and slow way to do this
// But it's nice to have it as a function
diff --git a/src/time.h b/src/time.h
index 6d90d5c..02505a5 100755
--- a/src/time.h
+++ b/src/time.h
@@ -29,3 +29,5 @@ int days_in(int month, int year);
std::string timeprint(moment input_moment);
+std::string timeprint(timeblock input_timeblock);
+