12 references to FormatDuration
Aspire.Dashboard (1)
Otlp\Model\OtlpSpanEvent.cs (1)
20string IPropertyGridItem.Name => DurationFormatter.FormatDuration(Time - span.StartTime);
Aspire.Dashboard.Tests (11)
DurationFormatterTests.cs (11)
32Assert.Equal("1μs", DurationFormatter.FormatDuration(TimeSpan.FromTicks(1 * TimeSpan.TicksPerMicrosecond))); 39Assert.Equal("10d 14h", DurationFormatter.FormatDuration(TimeSpan.FromTicks(input))); 46Assert.Equal("2d", DurationFormatter.FormatDuration(TimeSpan.FromTicks(input))); 53Assert.Equal(2.36m.ToString("0.##ms", CultureInfo.CurrentCulture), DurationFormatter.FormatDuration(TimeSpan.FromTicks(input))); 60Assert.Equal(2.36m.ToString("0.##s", CultureInfo.CurrentCulture), DurationFormatter.FormatDuration(TimeSpan.FromTicks(input))); 67Assert.Equal("2m 31s", DurationFormatter.FormatDuration(TimeSpan.FromTicks(input))); 74Assert.Equal("2h 31m", DurationFormatter.FormatDuration(TimeSpan.FromTicks(input))); 81Assert.Equal(0.92m.ToString("0.##ms", CultureInfo.CurrentCulture), DurationFormatter.FormatDuration(TimeSpan.FromTicks(input))); 88Assert.Equal(0.92m.ToString("0.##s", CultureInfo.CurrentCulture), DurationFormatter.FormatDuration(TimeSpan.FromTicks(input))); 95Assert.Equal(0.1m.ToString("0.##μs", CultureInfo.CurrentCulture), DurationFormatter.FormatDuration(TimeSpan.FromTicks((long)input))); 102Assert.Equal("0μs", DurationFormatter.FormatDuration(TimeSpan.FromTicks(input)));