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:
parent
0d83c5a39a
commit
31b7ce053d
@ -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);
|
||||
|
@ -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;
|
||||
if (years < 20)
|
||||
return FormatQuantity("yr", years);
|
||||
|
||||
return "never";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user