Skip to content

Commit c586679

Browse files
chopperbrianoclaude
andcommitted
Dashboard: add Time and Uptime row to header grid (win.24)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d1bb314 commit c586679

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ SET(PATCH_VERSION 0)
4040
SET(SO_VERSION 0)
4141

4242
# Windows port build number (increment for each Windows-specific release)
43-
SET(WIN_BUILD 23)
43+
SET(WIN_BUILD 24)
4444

4545
# Add source directory
4646
include_directories(src)

src/ConsoleDashboard.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <iostream>
1212
#include <sstream>
1313
#include <iomanip>
14+
#include <ctime>
1415
#include <algorithm>
1516
#include <cmath>
1617

@@ -45,6 +46,7 @@ static inline std::string moveTo(int row, int col) {
4546

4647
ConsoleDashboard::ConsoleDashboard() {
4748
_lastTime = std::chrono::steady_clock::now();
49+
_startTime = std::chrono::system_clock::now();
4850
}
4951

5052
ConsoleDashboard::~ConsoleDashboard() {
@@ -490,6 +492,25 @@ void ConsoleDashboard::render() {
490492
}
491493
}
492494

495+
// Row: Time and Uptime
496+
{
497+
auto now = std::chrono::system_clock::now();
498+
auto time_t_val = std::chrono::system_clock::to_time_t(now);
499+
std::tm* timeinfo = std::localtime(&time_t_val);
500+
std::ostringstream timeOss;
501+
timeOss << std::put_time(timeinfo, "%H:%M:%S");
502+
std::string timeStr = timeOss.str();
503+
504+
// Calculate uptime
505+
auto uptime_seconds = std::chrono::duration_cast<std::chrono::seconds>(now - _startTime).count();
506+
std::string uptimeStr = formatDuration((double)uptime_seconds);
507+
508+
out << ERASE_LINE << " "
509+
<< cell("Time", timeStr, FG_BRIGHT_WHITE, COL1_LABEL_W, COL1_VALUE_W)
510+
<< cell("Uptime", uptimeStr, FG_BRIGHT_WHITE, COL2_LABEL_W, 0)
511+
<< "\n"; totalRows++;
512+
}
513+
493514
// Row 5: separator
494515
out << ERASE_LINE << std::string(w, '-') << "\n"; totalRows++;
495516

src/ConsoleDashboard.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ class ConsoleDashboard {
8383
uint64_t _assetCount = 0;
8484
std::chrono::steady_clock::time_point _lastAssetCountTime;
8585

86+
// Application start time (system_clock for displaying actual time)
87+
std::chrono::system_clock::time_point _startTime;
88+
8689
// Keyboard input
8790
std::atomic<bool> _quitRequested{false};
8891
std::function<void()> _quitCallback;

0 commit comments

Comments
 (0)