diff --git a/src/lib/component/controller/CodeController.cpp b/src/lib/component/controller/CodeController.cpp index bbfe7f30..ac1f7832 100644 --- a/src/lib/component/controller/CodeController.cpp +++ b/src/lib/component/controller/CodeController.cpp @@ -69,6 +69,12 @@ void CodeController::handleMessage(MessageActivateAll* message) ErrorCountInfo errorCount = m_storageAccess->getErrorCount(); ss << "\n"; + if (stats.timestamp.isValid()) + { + ss << "\tlast indexed: " + stats.timestamp.toString() + "\n"; + ss << "\n"; + } + ss << "\t" + std::to_string(stats.fileCount) + " files"; ss << (stats.completedFileCount != stats.fileCount ? " (" + std::to_string(stats.completedFileCount) + " complete)" : "") + "\n"; ss << "\t" + std::to_string(stats.fileLOCCount) + " lines of code\n"; diff --git a/src/lib/data/PersistentStorage.cpp b/src/lib/data/PersistentStorage.cpp index dde4a9ce..d3af6314 100644 --- a/src/lib/data/PersistentStorage.cpp +++ b/src/lib/data/PersistentStorage.cpp @@ -559,6 +559,7 @@ void PersistentStorage::optimizeMemory() TRACE(); m_sqliteIndexStorage.setVersion(); + m_sqliteIndexStorage.setTime(); m_sqliteIndexStorage.optimizeMemory(); m_sqliteBookmarkStorage.setVersion(); @@ -1411,6 +1412,8 @@ StorageStats PersistentStorage::getStorageStats() const stats.completedFileCount = m_sqliteIndexStorage.getCompletedFileCount(); stats.fileLOCCount = m_sqliteIndexStorage.getFileLineSum(); + stats.timestamp = m_sqliteIndexStorage.getTime(); + return stats; } diff --git a/src/lib/data/SqliteStorage.cpp b/src/lib/data/SqliteStorage.cpp index c3fdc4ba..90834af1 100644 --- a/src/lib/data/SqliteStorage.cpp +++ b/src/lib/data/SqliteStorage.cpp @@ -1,6 +1,7 @@ #include "SqliteStorage.h" #include "utility/logging/logging.h" +#include "utility/TimePoint.h" SqliteStorage::SqliteStorage(const FilePath& dbFilePath) : m_dbFilePath(dbFilePath.canonical()) @@ -119,6 +120,16 @@ void SqliteStorage::setVersion() setApplicationVersion(); } +void SqliteStorage::setTime() +{ + insertOrUpdateMetaValue("timestamp", TimePoint::now().toString()); +} + +TimePoint SqliteStorage::getTime() const +{ + return TimePoint(getMetaValue("timestamp")); +} + void SqliteStorage::setupMetaTable() { try diff --git a/src/lib/data/SqliteStorage.h b/src/lib/data/SqliteStorage.h index 83ec2161..481f1804 100644 --- a/src/lib/data/SqliteStorage.h +++ b/src/lib/data/SqliteStorage.h @@ -7,6 +7,8 @@ #include "utility/file/FilePath.h" #include "utility/Version.h" +class TimePoint; + class SqliteStorage { public: @@ -38,6 +40,8 @@ public: bool isIncompatible() const; void setVersion(); + void setTime(); + TimePoint getTime() const; protected: void setupMetaTable(); diff --git a/src/lib/data/StorageStats.h b/src/lib/data/StorageStats.h index 29930d40..fbe24d5d 100644 --- a/src/lib/data/StorageStats.h +++ b/src/lib/data/StorageStats.h @@ -1,6 +1,8 @@ #ifndef STORAGE_STATS_H #define STORAGE_STATS_H +#include "utility/TimePoint.h" + struct StorageStats { StorageStats() @@ -17,6 +19,8 @@ struct StorageStats size_t fileCount; size_t completedFileCount; size_t fileLOCCount; + + TimePoint timestamp; }; #endif // STORAGE_STATS_H