enhance: more readable command log duration (#1570)

This commit is contained in:
Nathan Baulch
2025-07-14 13:37:36 +10:00
committed by GitHub
parent d406cb8d28
commit d09ae6c55c

View File

@@ -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;