Add config in settings for forcing 24H time, determines default off CurrentCulture

This commit is contained in:
Perry MacMurray
2022-04-05 16:21:28 -04:00
parent 74706f72e6
commit 9d475f7b33
5 changed files with 36 additions and 3 deletions

View File

@ -29,7 +29,21 @@ namespace osu.Game.Overlays.Toolbar
}
}
private bool format12H = true;
private bool format12H = false;
public bool Format12H
{
get => format12H;
set
{
if (format12H == value)
return;
format12H = value;
updateMetrics();
UpdateDisplay(DateTimeOffset.Now); //Update realTime.Text immediately instead of waiting until next second
}
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
@ -52,14 +66,14 @@ namespace osu.Game.Overlays.Toolbar
protected override void UpdateDisplay(DateTimeOffset now)
{
realTime.Text = format12H ? $"{now:hh:mm:ss tt}" : $"{now:HH:mm:ss}";
realTime.Text = format12H ? $"{now:h:mm:ss tt}" : $"{now:HH:mm:ss}";
gameTime.Text = $"running {new TimeSpan(TimeSpan.TicksPerSecond * (int)(Clock.CurrentTime / 1000)):c}";
}
private void updateMetrics()
{
if (format12H)
Width = 74;
Width = 70;
else
Width = showRuntime ? 66 : 45; // Allows for space for game time up to 99 days (in the padding area since this is quite rare).