mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 04:02:59 +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 now = DateTime.Now;
|
||||||
var difference = now - Date;
|
var difference = now - Date;
|
||||||
|
|
||||||
const double seconds_to_blank = 60*45;
|
const double seconds_to_blank = 60 * 45;
|
||||||
const double tense_factor = 2.325;
|
const double tense_factor = 2.325;
|
||||||
|
|
||||||
double tf = Math.Pow(difference.TotalSeconds / seconds_to_blank, tense_factor);
|
double tf = Math.Pow(difference.TotalSeconds / seconds_to_blank, tense_factor);
|
||||||
|
@ -14,13 +14,12 @@ namespace osu.Game.Utils
|
|||||||
{
|
{
|
||||||
if (quantity <= 1)
|
if (quantity <= 1)
|
||||||
return $@"{quantity}{template}";
|
return $@"{quantity}{template}";
|
||||||
|
|
||||||
return $@"{quantity}{template}s";
|
return $@"{quantity}{template}s";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string FormatDate(DateTimeOffset time, TimeSpan lowerCutoff)
|
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.
|
// 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.
|
// this is intended to be a best-effort, more legible approximation of that.
|
||||||
// compare:
|
// compare:
|
||||||
@ -57,10 +56,13 @@ namespace osu.Game.Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
int years = 1;
|
int years = 1;
|
||||||
// DateTime causes a crash here for epoch
|
// Add upper bound to prevent a crash
|
||||||
while (time <= now.AddYears(-(years + 1)))
|
while (years < 20 && time <= now.AddYears(-(years + 1)))
|
||||||
years += 1;
|
years += 1;
|
||||||
|
if (years < 20)
|
||||||
return FormatQuantity("yr", years);
|
return FormatQuantity("yr", years);
|
||||||
|
|
||||||
|
return "never";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user