diff --git a/client/helper.cpp b/client/helper.cpp index 04f9178..02349d9 100644 --- a/client/helper.cpp +++ b/client/helper.cpp @@ -138,6 +138,15 @@ bool date::operator >= (const date& rhs) return std::tie(mYear, mMonth, mDay) >= std::tie(rhs.mYear, rhs.mMonth, rhs.mDay); } +std::string date::toString() const +{ + char buffer[32]; + sprintf(buffer, "%02d:%02d:%02d", mDay, mMonth, mYear); + + return buffer; +} + + time::time(int h, int m, int s) :mHour(h), mMinute(m), mSecond(s) {} diff --git a/client/helper.h b/client/helper.h index 11cc39f..9fb2e66 100644 --- a/client/helper.h +++ b/client/helper.h @@ -39,6 +39,8 @@ namespace helper bool operator > (const date& rhs); bool operator == (const date& rhs); bool operator >= (const date& rhs); + + std::string toString() const; }; struct time diff --git a/client/storage.cpp b/client/storage.cpp index 2f45b91..db59d32 100644 --- a/client/storage.cpp +++ b/client/storage.cpp @@ -228,7 +228,6 @@ bool Storage::open() mDatabase->exec("pragma locking_mode=EXCLUSIVE"); mDatabase->exec("pragma journal_mode=MEMORY"); mDatabase->exec("pragma temp_store=MEMORY"); - } catch(std::exception& e) { diff --git a/client/task.cpp b/client/task.cpp index 5032036..ae7582b 100644 --- a/client/task.cpp +++ b/client/task.cpp @@ -3,7 +3,7 @@ #include "helper.h" #include -#include +#include #if defined(TARGET_OSX) || defined(TARGET_LINUX) # include @@ -720,6 +720,16 @@ int TimeLine::month() if (date::fromTimestamp(lowIter->endTime(), date::To_LocalTime).mMonth >= this_month.mMonth) { + // For tests only + // auto date_start = date::fromTimestamp(lowIter->startTime(), date::To_LocalTime); + // auto time_start = time::fromTimestamp(lowIter->startTime(), date::To_LocalTime); + + // auto date_end = date::fromTimestamp(lowIter->endTime(), date::To_LocalTime); + // auto time_end = time::fromTimestamp(lowIter->endTime(), date::To_LocalTime); + // std::cout << date_start.toString() << " " << time_start.toString() << " - " + // << date_end.toString() << " " << time_end.toString() + // << " id: " << lowIter->id() << std::endl; + // GMT time! time_t month_begin = this_month.toTimestamp(); time_t month_end = month_begin + date::daysInMonth(this_month.mYear, this_month.mMonth) * 86400 - 1;