1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 22:22:55 +08:00

Fix CI issues

This commit is contained in:
dekrain 2022-02-19 21:18:26 +01:00
parent 0d83c5a39a
commit 31b7ce053d
No known key found for this signature in database
GPG Key ID: E20077A4AB510334
2 changed files with 8 additions and 6 deletions

View File

@ -404,7 +404,7 @@ namespace osu.Game.Online.Leaderboards
var now = DateTime.Now;
var difference = now - Date;
const double seconds_to_blank = 60*45;
const double seconds_to_blank = 60 * 45;
const double tense_factor = 2.325;
double tf = Math.Pow(difference.TotalSeconds / seconds_to_blank, tense_factor);

View File

@ -14,13 +14,12 @@ namespace osu.Game.Utils
{
if (quantity <= 1)
return $@"{quantity}{template}";
return $@"{quantity}{template}s";
}
public static string FormatDate(DateTimeOffset time, TimeSpan lowerCutoff)
{
// This function fails if the passed in time is something close to an epoch
// web uses momentjs's custom locales to format the date for the purposes of the scoreboard.
// this is intended to be a best-effort, more legible approximation of that.
// compare:
@ -57,10 +56,13 @@ namespace osu.Game.Utils
}
int years = 1;
// DateTime causes a crash here for epoch
while (time <= now.AddYears(-(years + 1)))
// Add upper bound to prevent a crash
while (years < 20 && time <= now.AddYears(-(years + 1)))
years += 1;
return FormatQuantity("yr", years);
if (years < 20)
return FormatQuantity("yr", years);
return "never";
}
}
}