From b629d2a532939cde12c700dbabab27a79d6f8c88 Mon Sep 17 00:00:00 2001 From: Nathan Baulch Date: Mon, 14 Jul 2025 08:27:17 +1000 Subject: [PATCH] enhance: more readable command log duration --- src/Views/CommandLogTime.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Views/CommandLogTime.cs b/src/Views/CommandLogTime.cs index 0e51c1e32..3e56c08e1 100644 --- a/src/Views/CommandLogTime.cs +++ b/src/Views/CommandLogTime.cs @@ -68,11 +68,14 @@ private void StopTimer() } } - private string GetDisplayText(ViewModels.CommandLog log) + private static string GetDisplayText(ViewModels.CommandLog log) { var endTime = log.IsComplete ? log.EndTime : DateTime.Now; - var duration = (endTime - log.StartTime).ToString(@"hh\:mm\:ss\.fff"); - return $"{log.StartTime:T} ({duration})"; + var duration = endTime - log.StartTime; + var durationStr = duration.TotalSeconds >= 1 + ? $"{duration.TotalSeconds:G3} s" + : $"{duration.TotalMilliseconds:G3} ms"; + return $"{log.StartTime:T} ({durationStr})"; } private Timer _refreshTimer = null;