Skip to content

Commit d09ae6c

Browse files
authored
enhance: more readable command log duration (#1570)
1 parent d406cb8 commit d09ae6c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Views/CommandLogTime.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,14 @@ private void StopTimer()
6868
}
6969
}
7070

71-
private string GetDisplayText(ViewModels.CommandLog log)
71+
private static string GetDisplayText(ViewModels.CommandLog log)
7272
{
7373
var endTime = log.IsComplete ? log.EndTime : DateTime.Now;
74-
var duration = (endTime - log.StartTime).ToString(@"hh\:mm\:ss\.fff");
75-
return $"{log.StartTime:T} ({duration})";
74+
var duration = endTime - log.StartTime;
75+
var durationStr = duration.TotalSeconds >= 1
76+
? $"{duration.TotalSeconds:G3} s"
77+
: $"{duration.TotalMilliseconds:G3} ms";
78+
return $"{log.StartTime:T} ({durationStr})";
7679
}
7780

7881
private Timer _refreshTimer = null;

0 commit comments

Comments
 (0)