From d09ae6c55c7c6fbb7e9954f6fc787abb89a940eb Mon Sep 17 00:00:00 2001 From: Nathan Baulch Date: Mon, 14 Jul 2025 13:37:36 +1000 Subject: [PATCH] enhance: more readable command log duration (#1570) --- 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 0e51c1e3..3e56c08e 100644 --- a/src/Views/CommandLogTime.cs +++ b/src/Views/CommandLogTime.cs @@ -68,11 +68,14 @@ namespace SourceGit.Views } } - 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;