Skip to content

Commit

Permalink
Modulo time spent for large gaps
Browse files Browse the repository at this point in the history
Taking too many seconds to beat the storyline -> overflow on ticks. Since we already shave off the days portion, use the modulo to remove the day portion from the time portion.

Closes #4184
  • Loading branch information
kwsch committed Feb 10, 2024
1 parent da83f10 commit 069411d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions PKHeX.Core/Util/DateUtil.cs
Expand Up @@ -57,6 +57,7 @@ public static string ConvertDateValueToString(int value, int secondsBias = -1)
var sb = new System.Text.StringBuilder();
if (value >= SecondsPerDay)
sb.Append(value / SecondsPerDay).Append("d ");
value %= SecondsPerDay;
sb.Append(new TimeOnly(ticks: value * TimeSpan.TicksPerSecond).ToString("HH:mm:ss"));
if (secondsBias >= 0)
sb.Append(Environment.NewLine).Append("Date: ").Append(Epoch2000.AddSeconds(value + secondsBias));
Expand Down

0 comments on commit 069411d

Please sign in to comment.