From c588cd74514de3eeaa5859f1e6b36878e6fe5194 Mon Sep 17 00:00:00 2001 From: Mike Nolan Date: Tue, 25 Nov 2025 23:22:55 -0600 Subject: [PATCH] Fix datetime bug with timespan using spaces instead of zeros --- include/TessesFramework/Date/Date.hpp | 5 ++++- src/Date/Date.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/TessesFramework/Date/Date.hpp b/include/TessesFramework/Date/Date.hpp index 97f15e0..43b2064 100644 --- a/include/TessesFramework/Date/Date.hpp +++ b/include/TessesFramework/Date/Date.hpp @@ -135,5 +135,8 @@ namespace Tesses::Framework::Date { return dt.ToEpoch() - dt2.ToEpoch(); } - + inline TimeSpan operator-(const TimeSpan& ts, const TimeSpan& ts2) + { + return ts.TotalSeconds() - ts2.TotalSeconds(); + } }; \ No newline at end of file diff --git a/src/Date/Date.cpp b/src/Date/Date.cpp index e9943d2..72babd1 100644 --- a/src/Date/Date.cpp +++ b/src/Date/Date.cpp @@ -861,7 +861,7 @@ namespace Tesses::Framework::Date //hours must force multi digit minutes str += std::to_string(this->Hours()); str += ":"; - str += Http::HttpUtils::LeftPad(std::to_string(this->Minutes()),2,' '); + str += Http::HttpUtils::LeftPad(std::to_string(this->Minutes()),2,'0'); } else { @@ -869,7 +869,7 @@ namespace Tesses::Framework::Date } str += ":"; - str += Http::HttpUtils::LeftPad(std::to_string(this->Seconds()),2,' '); + str += Http::HttpUtils::LeftPad(std::to_string(this->Seconds()),2,'0'); } else { @@ -882,11 +882,11 @@ namespace Tesses::Framework::Date str += "."; } - str += Http::HttpUtils::LeftPad(std::to_string(this->Hours()),2,' '); + str += Http::HttpUtils::LeftPad(std::to_string(this->Hours()),2,'0'); str += ":"; - str += Http::HttpUtils::LeftPad(std::to_string(this->Minutes()),2,' '); + str += Http::HttpUtils::LeftPad(std::to_string(this->Minutes()),2,'0'); str += ":"; - str += Http::HttpUtils::LeftPad(std::to_string(this->Seconds()),2,' '); + str += Http::HttpUtils::LeftPad(std::to_string(this->Seconds()),2,'0'); } return str;