From b185bf50809719854d1e07f6603d627a26d3222b Mon Sep 17 00:00:00 2001 From: Tung Huynh Date: Sun, 24 Dec 2023 01:51:41 -0800 Subject: [PATCH] fix: incorrect time left display for values greater than an hour --- Screenbox.Core/Common/Humanizer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Screenbox.Core/Common/Humanizer.cs b/Screenbox.Core/Common/Humanizer.cs index 6023da4e2..08d92411a 100644 --- a/Screenbox.Core/Common/Humanizer.cs +++ b/Screenbox.Core/Common/Humanizer.cs @@ -12,8 +12,8 @@ public static string ToDuration(double value) public static string ToDuration(TimeSpan duration) { - int hours = (int)duration.TotalHours; - return (duration < TimeSpan.Zero ? "-" : string.Empty) + (hours > 0 ? $"{hours}:{duration:mm}:{duration:ss}" : duration.ToString(@"%m\:ss")); + long hours = Math.Abs((long)duration.TotalHours); + return (duration < TimeSpan.Zero ? "-" : string.Empty) + (hours != 0 ? $"{hours}:{duration:mm}:{duration:ss}" : duration.ToString(@"%m\:ss")); } } }